Closed gayathri1305 closed 1 month ago
package cucumber;
import courgette.api.*; import courgette.api.junit.Courgette; import org.junit.runner.RunWith;
@RunWith(Courgette.class) @CourgetteOptions( threads = 5, runLevel = CourgetteRunLevel.SCENARIO, rerunFailedScenarios = true, testOutput = CourgetteTestOutput.CONSOLE, plugin = CourgettePlugin.EXTENT_REPORTS, reportTargetDir = CucumberRunnerE2ETest.reportTargetDir, cucumberOptions = @CucumberOptions( features = "functional-tests/src/test/java/cucumber/features/testFeature.feature", glue = "cucumber.steps", tags = {"@all"}, plugin = {"pretty", "json:functional-tests/report/cucumber-report/cucumber.json", "html:functional-tests/report/cucumber-report/cucumber.html"}, publish = false ))
public class CucumberRunnerE2ETest { @CourgetteBeforeAll public static void setUp() { public final static String reportTargetDir= System.getProperty("user.dir") + "/functional-tests/report"; System.out.println("** : "+ reportTargetDir);
}
}
Is it possible to pass the reportTargetDir in this way. It is also giving erroe
Hello,
You cannot provide the reportTargetDir
in the way that you have as it will not be available to the runner.
You also don't need to provide an absolute path.
Have you tried:
@RunWith(Courgette.class)
@CourgetteOptions(
reportTargetDir= "functional-tests/report",
)
public class Runner {
}
You can also provide this at runtime using:
-Dcourgette.reportTargetDir="functional-tests/report"
Hi Prasanth, I tried both way. But I am facing issue in both way. It is not generating the index.html file in courgette-report folder. It was throwing filenotfound exception (it is searching report.json and report.ndjson in courgette-report folder).
cucumber.CucumberRunnerE2ETest STANDARD_ERROR
java.io.FileNotFoundException: functional-tests/report/courgette-report/data/report.ndjson (No such file or directory)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
at java.base/java.io.FileOutputStream.
Hi, could you provide a project I can reproduce this with? Thanks.
Closing inactive issue
Hi My automation test folder is coming under another folder. If I give reportTargetDir ="build", it is not generating report properly. Reason is build folder is generated project root repo and inside the automation test folder also. So when writing the report file, it was throwing java.io.FileNotFoundException: build/courgette-report/data/report.ndjson (No such file or directory). Can you help me on this?
project-root │ └── functional-tests ├── src └── test ├── java │ └── cucumber │ └── CucumberRunnerE2ETest └── resources