Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set global prefix per class to scenarios #133

Closed
nikowitt opened this issue Sep 30, 2015 · 15 comments
Closed

Ability to set global prefix per class to scenarios #133

nikowitt opened this issue Sep 30, 2015 · 15 comments

Comments

@nikowitt
Copy link
Contributor

Hi Jan, some more feedback.

There are lots of security tests implemented that extend from a base class that also contains scenarios, e.g. "Validate create access" which is then called in a QuestionSecurityTestSuite and a ResponseSecurityTestSuite.

In the report, it is now difficult to see which scenario belongs to which test as there are just several "Validate create access" scenarios listed. A "group by class" (which is one additional click) solves this issue, but the class name might be too technical for non developers.

What would be great is to be able to define some global prefix by class that is prepended to the scenarios that are executed in the class. This way, the inherited generic "Validate create access" tests can have unique names (e.g. "Question - Validate create access" or "Response - Validate create access") and lots of wrapper methods that are only required to create unique names can be omitted.

Best regards,
Niko

@janschaefer
Copy link
Contributor

That is an interesting suggestion. We also have a similar problem actually. The general problem is actually that one wants to group scenarios and give that group a name. The question is if the scenario should really be just prefixed or whether this should be a separate attribute of the scenario that could also be rendered differently in the report. It is somewhat similar to a tag with the exception that there can only be exactly one group name for a scenario.

@nikowitt
Copy link
Contributor Author

Probably a separate attribute is indeed the better approach for this as it provides more possibilities to use this for other purposes. The scenario views should be then sorted by this attribute by default - when the attribute is not set, it will look like the "none" group by condition.

janschaefer pushed a commit that referenced this issue Sep 30, 2015
@janschaefer
Copy link
Contributor

I implemented a first approach. Test classes can now have the @As annotation to give them a name. This name is then prefixed in the list of scenarios and can also be used to group them. I also changed the design of the group header. Let me know what you think:

http://jgiven.org/snapshot/jgiven-report/html5/#/all

@nikowitt
Copy link
Contributor Author

nikowitt commented Oct 1, 2015

Looks great, it is exactly what I've expected. What is also important IMHO is that the Class Title is the default group condition.

UPDATE: On a second thought, this is not really required as we already have an implicit grouping by alphabetical order and @as annotated scenarios are preferred.

@janschaefer
Copy link
Contributor

The more I use this new feature, the more I like it. I think this will be really useful. I like it so much that I now even generate a title for every class by using the class name and convert the camel case into readable text.

@nikowitt
Copy link
Contributor Author

nikowitt commented Oct 2, 2015

This is indeed a good default value :)

@nikowitt
Copy link
Contributor Author

nikowitt commented Oct 2, 2015

Is there a scheduled release date for 0.9? :)

@janschaefer
Copy link
Contributor

If you want I can publish a SNAPSHOT version with what is currently there. You could use this then by including the sonatype snapshot repository (https://oss.sonatype.org/content/repositories/snapshots)

@nikowitt
Copy link
Contributor Author

nikowitt commented Oct 2, 2015

If it is not too much work for you, I'd be glad to be able to use that version in our environment.

@janschaefer
Copy link
Contributor

Done. (It is about as much work as writing this comment ;-))

@janschaefer
Copy link
Contributor

It is published under version 0.9.0-SNAPSHOT

@nikowitt
Copy link
Contributor Author

nikowitt commented Oct 2, 2015

Thanks, Jan! Have a nice weekend!

@janschaefer
Copy link
Contributor

You are welcome!

@janschaefer
Copy link
Contributor

I have configured travis now to publish a snapshot version of every successful build from master.

@nikowitt
Copy link
Contributor Author

nikowitt commented Oct 3, 2015

Even better :)

janschaefer pushed a commit that referenced this issue Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants