Importing test results generated by Serenity BDD

During execution of test Serenity BDD generate Test Outcomes and use them to build aggregated report. It is possible for some external tools load test outcomes and analise them.

Loading Test OutComes from folder

Test outcomes by default are generated in XML and JSON format, both format contains same information - testcase, suites, test results, rest queries and so on. Serenity BDD uses recreation of these test result - 'TestOutcome' and some extra features available in 'TestOutcomes'.

To load test outcome you should know their format and folder:

....
OutcomeFormat format = OutcomeFormat.XML;
TestOutcomes outcomes = TestOutcomeLoader.loadTestOutcomes().inFormat(format)
....

Analysing Test OutComes

It is easy to analise test outcomes, for example for getting all passed test you should:

....
outcomes.getPassingTests();
....

Also you can get a lot of information from test ourcomes about execute tests, for example:

....
 for (final TestOutcome outcome : outcomes.getOutcomes()) {
     System.out.println(outcome.getCompleteName());
     System.out.println(outcome.getTestCaseName());
     System.out.println(outcome.getResult());
     System.out.println(outcome.getDurationInSeconds());
     System.out.println(outcome.getDataTable()); // if test was with some data table
     System.out.println(outcome.getIssueKeys());
 }
....