Hello Team,
I badly need your help to resolve one issue that I am facing
I have a Gradle Cucumber Framework set up. In my TestRunner Class I have below code
@RunWith(Cucumber.class)
@CucumberOptions(plugin = {"pretty", "html:target/cucumber-reports", "json:target/cucumber-reports/Cucumber.json", "junit:target/cucumber-reports/Cucumber.xml",},
features = {"src/test/resources"}, glue = {"com.healthcheck.services.StepDefenitions"})
public class TestRunner {
@AfterClass
public static void tearDown() {
System.out.println("Inside @AfterClass");
System.out.println(Base.resultList);
Base.buildReportAndSendToSlack(Base.env_test, Base.resultList, Base.failedScenariosMap);
}
}
When I run from the IntelliJ, (Run TestRunner ) the J Unit AfterClass is being executed whereas when I run the Gradle task (task in build.gradle file as below) from command line, AfterClass is not executed.
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--plugin', 'html:target/cucumber-reports', '--plugin', 'json:target/cucumber-reports/Cucumber.json', '--plugin', 'junit:target/cucumber-reports/Cucumber.xml', '--glue', 'com.healthcheck.services.StepDefenitions', 'src/test/resources/com/healthcheck/services/Features']
}
}
}
It would be of great help if you could extend your help to resolve this issue
Thanks
Ansar