read cucumber result File within cucumber project

215 Views Asked by At

is there any way to read result File after the execution and generation of result file in through same project i am using cucumber maven project

@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/Feature", glue = { "stepDefinition" }, plugin = { "pretty",
        "json:target/sample.json" }, monochrome = true)

mvn clean test

1

There are 1 best solutions below

0
On

You can read the file in the target directory.

SomeClass.class.getProtectionDomain().getCodeSource().getLocation().getPath().getParentPath()+"/sample.json"

Or you can extend the json reporter, to read the report before it's written