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

Hierarchy for Tags or Tests #90

Closed
ahus1 opened this issue Jul 15, 2015 · 13 comments
Closed

Hierarchy for Tags or Tests #90

ahus1 opened this issue Jul 15, 2015 · 13 comments
Assignees
Milestone

Comments

@ahus1
Copy link
Contributor

ahus1 commented Jul 15, 2015

To advocate for JGiven in a larger project I would like to see hierarchies for test cases.

This could lead to a business motivated hierarchy like:

category1\subcategory1\usecase1
category1\subcategory1\usecase2
category1\subcategory2\usecase3
category2\subcategory3\usecase4
category2\subcategory3\usecase5

One source of a hierarchy could be java package names (in JGiven i.e. see all tests in the com.tngtech.jgiven.report package). But this allows only for one hierarchy in the project.

Another source could a category for tags. Some pseudo-code:

@IsTag( type = "Usecase", value = "Usecase 1",
    description = "...", category = { "category1", "subcategory1" } )
@Retention( RetentionPolicy.RUNTIME )
public @interface Usecase1 {

}

As we have a TagDescriptionGenerator it would be useful for me to have also a TagCategoryGenerator to allow for parameterized annotations like this

@Usecase(name = "Usecase1", category = { "category1", "subcategory1" })

Please comment if you find this useful as well.

Thanks!

@janschaefer
Copy link
Contributor

This is more or less the same as #27 regarding the tags.
Regarding the hierarchy of test classes, do you mean that in the HTML5 report the test classes should be hierarchically structured by package name. Something like:

com
  tngtech
      jgiven
         report
         impl
         ...

Maybe even having the possibility to show all scenarios of a certain package?

@janschaefer
Copy link
Contributor

In #27 the suggestion would be to be define categories again as Java annotations and then annotate the @IsTag annotation with these categories, e.g.:

@Category1
@SubCategory2
@IsTag( type = "Usecase", value = "Usecase 1",
    description = "..."
@Retention( RetentionPolicy.RUNTIME )
public @interface Usecase1 {
}

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 15, 2015

@janschaefer - regarding package names, yes, a layout like

com
  tngtech
      jgiven
         report
         impl
         ...

would be perfect. When I select a package I would like to see the test cases in the selected package and in the subpackages. I'm always talking about the HTML5 report by the way.

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 15, 2015

@janschaefer - regarding annotations as outlined in #27 it would work for me as long as I can define as many hierarchy levels as needed. I the order of the annotations preserved (1st annotation = 1st level, 2nd annotation = 2nd level)?

BTW: I didn't think that #27 named "Meta Tag" would contain such a nice thing ... :-)

@janschaefer
Copy link
Contributor

Well, I actually would rather say that you only put the subcategory annotation to the tag. And the subcategory has as annotation the category, something like:

@SubCategory2
@IsTag( type = "Usecase", value = "Usecase 1",
    description = "..."
@Retention( RetentionPolicy.RUNTIME )
public @interface Usecase1 {
}
@Category1
@IsTag( type = "Usecase", value = "Usecase 1",
    description = "..."
@Retention( RetentionPolicy.RUNTIME )
public @interface SubCategory2 {
}

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 15, 2015

ok for me as long as multiple category levels are possible in the report.

@janschaefer
Copy link
Contributor

Sure. Ok, I will try to implement that. Shouldn't be too hard ;-)

@janschaefer
Copy link
Contributor

Hierarchy for test classes is now implemented in PR #91

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 21, 2015

Just built current version locally to have a look at PR #91. Looks really nice! Thanks a lot!

@janschaefer
Copy link
Contributor

Ok. Cool :-). Regarding the hierarchical tags: I am working on it, but it turned out to be more difficult than I first expected. I am nearly done though.

@janschaefer janschaefer mentioned this issue Jul 29, 2015
@janschaefer janschaefer self-assigned this Aug 2, 2015
@janschaefer janschaefer added this to the v0.8.0 milestone Aug 2, 2015
@janschaefer
Copy link
Contributor

Finally the feature is now implemented. #99

@ahus1
Copy link
Contributor Author

ahus1 commented Aug 3, 2015

Just looked at the jgiven-tests built from trunk. Tree navigation for features and classes is amazing. Thanks, Jan!

treenav_jgiven

@janschaefer
Copy link
Contributor

Thx :-)

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