serenity-bdd / serenity-maven-plugin

19 stars 21 forks source link

How to integrate surefire and serenity together. #56

Closed shubhamyannawar closed 6 years ago

shubhamyannawar commented 7 years ago

I am working on serenity but I want reports with both serenity and surefire .But when I am executing the test suit the suit get executed separately once for serenity and once for surefire and then I got the reports from both serenity and surefire. But I want reports generated for both serenity and surefire on single go. Is there any way to do so? Please help regarding this

wakaleo commented 7 years ago

I'm not sure I understand your question. You can run Serenity through the maven surefire plugin (or the failsafe plugin, which is more usual). When you run Serenity tests through surefire or failsafe, both surefire and Serenity reports will be generated.

shubhamyannawar commented 7 years ago

Thank you for you response. I have executed through surefire plugin it has generated the surefire reports but its generating partial serenity reports .It has generated few html files but index.html is missing so not able to get full serenity reports.

wakaleo commented 7 years ago

You will need to call the aggregate maven goal, by running mvn serentity:aggreagate

shubhamyannawar commented 7 years ago

executed clean verify serenity:aggregate surefire-report:report -Daggregate=true  site -DgenerateReports=false command but not worked .

wakaleo commented 7 years ago

clean verify serenity:aggregate should be enough. It is most likely an issue with your pom.xml file. Take a look at https://github.com/serenity-bdd/screenplay-pattern-todomvc/blob/master/pom.xml to see a working example.

shubhamyannawar commented 7 years ago

pom.xml.txt

Here is the pom.xml that I am using.

With clean verify serenity:aggregate its generating only serenity reports.

I have tried clean verify serenity:aggregate -Dmaven.test.failure.ignore=true surefire-report:report -Daggregate=true  site -DgenerateReports=false

with this command both surefire and serenity reports are generated but it has executed the test cases two times , Looking for the way by which I can generate both reports on single run

wakaleo commented 7 years ago

You will need to use the failsafe plugin rather than the surefire plugin to always get the aggregate reports generated.

wakaleo commented 6 years ago

Closing this for lack of activity.

Dvoreth commented 4 years ago

@wakaleo , is Serenity report generation still exclusive to the failsafe plugin? Or is there maybe some recommended hack to get it to work with surefire? I'm asking because I'm trying out TM4J which only works with the surefire plugin, so it would be quite neat to get reports with surefire as well.

wakaleo commented 4 years ago

It’s just a Maven plugin, you can integrate it anywhere you want. But surefire will make it harder to automatically generate the reports.

Dvoreth commented 4 years ago

Wow, thanks for the speedy reply! In case someone else has the same issue: Right now report generation seems to work with running tests via surefire as long as I use the execution phase "test" for the serenity-maven-plugin and explicitly trigger it using "serenity:aggregate" in the command line. I'll take wakaleo's reply to indicate that this is not guaranteed to work under all circumstances :) .

wakaleo commented 4 years ago

Yes, that’s how the test lifecycle phase works in Maven

Dvoreth commented 4 years ago

While I've got you: Could you elaborate a bit more on "surefire will make it harder to automatically generate the reports"? What does that depend on? Thank you in advance!