might you inform me methods to generate fairly html stories with screenshot ? After I run the check the “cucumber-reports.html” doesn’t exist. Solely “picture.png” file is generated.
package deal cucumber.Choices;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(options="src/check/java/options",
plugin = {"fairly", "html:goal/stories/cucumber-reports.html"},
glue= {"stepDefs"},
stepNotifications = true,
monochrome = true
)
public class TestRunner {
}
Methodology that does screenshot
@After
public void afterTest(Situation situation) throws IOException {
if (!situation.isFailed()) {
// String vacation spot = System.getProperty("consumer.dir") + "//src" + "//Screenshots" + situation + ".png";
ultimate byte[] screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
situation.connect(screenshot, "picture/png", situation.getName());
String listing = System.getProperty("consumer.dir") + "//goal" + "//stories";
File sourceFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(sourceFile, new File(listing, "picture.png"));
}
if (driver != null) {
driver.give up();
}
}
pom file
4.0.0
org.instance
Cucumber
1.0-SNAPSHOT
11
11
UTF-8
org.seleniumhq.selenium
selenium-java
4.4.0
org.testng
testng
RELEASE
check
io.cucumber
cucumber-java
7.8.1
io.cucumber
cucumber-junit
7.8.1
check
junit
junit
4.12
compile
org.assertj
assertj-core
3.23.1
check
io.github.bonigarcia
webdrivermanager
5.3.1
org.projectlombok
lombok
RELEASE
check
org.reflections
reflections
0.9.11
com.google.guava
guava
31.1-jre
org.seleniumhq.selenium
selenium-java
4.8.3
org.projectlombok
lombok
1.18.26
compile
org.slf4j
slf4j-simple
2.0.7
check
org.slf4j
slf4j-api
2.0.7
com.opencsv
opencsv
5.7.1
picocontainer
picocontainer
1.2
io.cucumber
cucumber-html
0.2.7
org.apache.maven.plugins
maven-surefire-plugin
3.0.0
io.cucumber
cucumber-core
7.11.2