こんにちは、みんな。 BDD (Jbehave) を使用した準備完了のプロジェクトがあります (Thucydides)
アリュール レポートをプロジェクトに接続する必要がありました。この目的のために、AllureReporter はここから取得されました allure-jbehave-reporter レポートは機能しており、すべて問題ありません。
ただし、大きな問題が 1 つあります。テストは、Selenium Hub の RemoteWebDriver を使用して開始されます。問題の内容とそこで何が起こっているかを理解するには、スクリーンショットが必要です。
現時点では、スクリーンショットは Allure によって撮影されていません。つまり、スクリーンショットは画面から取得されず、添付されません。
試した:
@Attachment(value = "Page screenshot", type = "image/png")
public byte[] saveScreenshot(byte[] screenShot) {
return screenShot;
}
と
public static byte[] takeScreenshot() {
WebDriver driver = ThucydidesWebDriverSupport.getDriver();
if (WebDriverFactory.isAlive(driver) && (driver instanceof TakesScreenshot)) {
return ((TakesScreenshot) driver).getScreenshotAs(OutputType.BYTES);
}
return null;
}
と
Allure.addAttachment()
それはすべて私のために働いていません。
この方法は機能し、画面からスクリーンショットを撮り、指定されたフォルダーを追加しますが、! レポートには添付されません。
@Attachment(value = "Page screenshot", type = "image/png")
public byte[] saveScreenAsImage() throws IOException {
WebDriver driver = ThucydidesWebDriverSupport.getDriver();
File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(file, new File("target/allure-results/" + file.getName()));
return Files.toByteArray(file);
}
これを解決する方法はありますか?
前もって感謝します。
POMはこちら
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-java-commons</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-generator</artifactId>
<version>2.5.0</version>
</dependency>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.9</version>
<configuration>
<reportVersion>2.6.0</reportVersion>
<allureDownloadUrl>https://dl.bintray.com/qameta/generic/io/qameta/allure/allure/2.6.0/allure-2.6.0.zip</allureDownloadUrl>
</configuration>
<executions>
<execution>
<id>allure-report</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>