Reputation: 23
I am attempting to gather up all the files my tests generate (log file, screenshots, cucumber report etc) and send them via email. I'm doing this from the Runner class using JUnit's @AfterClass annotation.
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/Features"
, glue = { "stepDefinition" }
, tags = { "@Teeest" }
, monochrome = true
, strict = false
, plugin = { /* "pretty", */ "html:target/cucumber-html-report","json:target/cucumber-html-report/cucumber-json-" + "report.json" })
public class TestRunner {
@AfterClass
public static void sendReport() {
SomeClass.sendMail();
}
}
Everything works fine except for the cucumber reports (both html and json), which are blank. When i manually check it, it looks good so I'm assuming it's generated sometime after this method is executed.
Does anyone have an idea of how I can get around this issue?
I'm thinking of either getting the Cucumber Reports plugin for Jenkins, writing a shell script to execute via Maven POM or a separate Java app that looks for the files, zips and sends the email.
All 3 of these ideas come with drawbacks so I'd really love another hook-type approach to this, if possible, as file locations have dynamic names and would be a lot easier to get the actual locations within the test suite than to look for them afterward.
Thanks!
PS: I am junior at this stuff so please don't hold back on details :)
Upvotes: 0
Views: 815