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

HTML5 Report: Introduce ordering of scenarios #79

Open
clementheliou opened this issue Jun 19, 2015 · 15 comments
Open

HTML5 Report: Introduce ordering of scenarios #79

clementheliou opened this issue Jun 19, 2015 · 15 comments

Comments

@clementheliou
Copy link

We may have quite a few scenarios for a given tag.
Currently, they are sorted using alphabetical ordering.

It could be useful to think about a mechanism allowing us to control the ordering used by report generation. The simplest solution probably is to annotate each scenario with its order but we could also think about other strategies.

@janschaefer
Copy link
Contributor

Yes. That is a very good point. I already thought about that issue and didn't come up with a good solution yet, so I would be very happy about suggestions. I would like to avoid additional annotations if possible.

@janschaefer
Copy link
Contributor

Issue #71 is somehow related to this one.

@clementheliou
Copy link
Author

I agree that this feature is not trivial.

Main issue is that a scenario can be related to many tags and its position may depends on the selected tag. We would need an order by tag, indeed an order for each tag combination!

I confess that I do not have the solution. Maybe can we find inspiration from others similar tools?

@janschaefer janschaefer changed the title HTML report: Introduce ordering of scenarios HTML5 report: Introduce ordering of scenarios Jun 20, 2015
@janschaefer
Copy link
Contributor

I finished a first implementation for grouping, sorting, and filtering. It is tracked now by PR #81.
There is a live demo here: http://jgiven.org/snapshot/jgiven-report/html5/#/all

If you want to test it on your project you can use v0.8.0-SNAPSHOT. You have to add the following snapshot repository to Maven/Gradle in order to get the SNAPSHOT version: https://oss.sonatype.org/content/repositories/snapshots

Alternatively you can just checkout the html5-app-sorting branch and just copy the content of the jgiven-html5-report/src/app folder into your generated html5 report folder:

cp -r jgiven-html5-report/src/app/* <your-html5-report-dir>

@clementheliou
Copy link
Author

Thanks.
It looks promising, especially the "tags" and "group by" parts.

@janschaefer
Copy link
Contributor

So do you think that this is enough for your use case? What I could add in addition would an option to sort by a tag. Then you could put tag-annotations on scenarios to define a certain order.

@clementheliou
Copy link
Author

This is a great improvement for the issue #80 use case. But it's not enough for the ordering one. Anyway, I don't think there is a trivial solution. One has to found a solution managing multi-tags combination.

Over a first phase, I'll see if the grouping capabilities are enough to deal with our scenarios.
I'll let you know if we need to found another solution.

Thanks for your great job ;)

@janschaefer
Copy link
Contributor

Ok. So I think a first easy solution would be to allow ordering by tags with values. For example, if you have a tag Issue that takes a string as a value. It would be easy to implement something like Sort By Issue. The sorting would then just take the value of the tag and use this for sorting.

This, however, only works if the value itself can be used for sorting. This should be true for most cases that I can think of. In addition, it would allow you to define an annotation Priority that takes a value that is then used for sorting.

@clementheliou
Copy link
Author

That could be a first solution.
Let's give it a try!

@janschaefer
Copy link
Contributor

Ok :-)

@janschaefer
Copy link
Contributor

I have implemented the sorting by tag. Its available with v0.8.0-SNAPSHOT. You can try it also out at http://jgiven.org/snapshot/jgiven-report/html5/#/all and 'Sort By -> Issue'.

@janschaefer janschaefer changed the title HTML5 report: Introduce ordering of scenarios HTML5 Report: Introduce ordering of scenarios Jun 26, 2015
@janschaefer
Copy link
Contributor

Do you think I can close the issue?

@clementheliou
Copy link
Author

I would keep it open as we only have a partial solution. ;)

By the way, the sort by tag option could probably be improved.
Let's say I defined an Order tag with an Integer value.
Then I can use the sort by tag option to sort my scenarios.

But these tags are displayed anyway and they are like boilerplate around my scenarios.
Could we have an option to hide them?

@janschaefer
Copy link
Contributor

Actually you can do that already by using the cssClass attribute of the @IsTag annotation. For example you can define:

.tag.hidden {
    display: none;
}

in a custom.css file and then write:

@IsTag( cssClass="hidden" )
@Retention( RetentionPolicy.RUNTIME )
public @interface Order {
}

@clementheliou
Copy link
Author

Ok. That's nice!

janschaefer pushed a commit that referenced this issue Jun 27, 2015
@janschaefer janschaefer modified the milestone: v0.8.0 Aug 9, 2015
@janschaefer janschaefer added this to the Backlog / Unplanned milestone Mar 31, 2017
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