I am running Cucumber+Serenity Tests using Junit:
Code snippet:
JUnitCore engine = new JUnitCore();
engine.addListener(new TextListener(System.out));
engine.run(featureClass);
For the each test execution individual html report is getting generated ,but aggregated(combined) report is not getting generated using HtmlAggregateStoryReporter directly(Reffered:https://github.com/serenity-bdd/serenity-core/issues/244)
Here is the code snippet that I used,it is getting hanged and aggregation is not completing .I am calling after all the Cucumber+Serenity Tests are completed:
HtmlAggregateStoryReporter reporter = new HtmlAggregateStoryReporter("PoC-Test");
File sourceDirectory = new File("C:\\PoC-Test\\target\\site\\serenity\\");
reporter.setSourceDirectory(sourceDirectory);
reporter.generateReportsForTestResultsFrom(reporter.getSourceDirectory());
C:\PoC-Test\target\site\serenity\ is the location where the individual Tests reports are getting generated,Could you please help me to find out what is wrong in this code?
Please share any sample working code,if any?
Are you adding the Serenty's aggregate
goal to your build? What build tool are you using?
Here's a solution which should work for Maven:
Either
serenity:aggregate
goal to your call statement. This will run your build and execute aggregation of the report. E.g.:mvn test -Dserenity.outputDirectory=C:/PoC-Test/target/site/serenity serenity:aggregate
or
serenity:aggregate
after your build is done, e.g.:mvn serenity:aggregate -Dserenity.outputDirectory=C:/PoC-Test/target/site/serenity