serenity-bdd / serenity-cucumber

Cucumber integration for the Serenity BDD Reporting library
Other
78 stars 74 forks source link

how to upload cucumber serenity logs to external drive #203

Open varmavg opened 5 years ago

varmavg commented 5 years ago

hope someone can help me with question below.

We have a requirement where we need to upload cucumber serenity logs to external Drive for future use (we are running the tests sequential and parallel using Jenkins ).

We have an internal API which we invoke @BeforeClass (which makes connection) -->runs all the tests--> @AfterClass (where we are trying to upload the results to external box). But upload piece is not working as expected (we are seeing inconsistent results).

I understand that serenity will compile index.html once the test is complete and may take some time (due to which upload is happening but sometimes index.html file was not created by the time our @AfterClass code is completed) .

Is there any easy way to achieve this functionality with in code?

wakaleo commented 5 years ago

You would normally do this as part of your CI build, not as part of your automated tests. The index.html is generated when you run the serenity aggregate task, not when the @afterclass hooks are called, so it would be cleaner to associate the uploading with a step in your Jenkins build.

nbarrett commented 5 years ago

On further thought @varmavg ... if you are running parallel Jenkins jobs then it definitely makes sense to defer any aggregation tasks to a separate stage in your pipeline and run this task at the end. Within each of the parallel slices, you can stash serenity report files (and / or app logs) , then unstash each of the slice report files in the aggregate task run in the final stage. This is explained at a high level in the documentation. In this way there will never be a case where there are timing issues, as Jenkins will ensure that each parallel slice is complete before commencing with the final pipeline stage.