Я могу создать отчет об очаровании в проекте на основе java-cucumber-Junit. Однако я не могу получить шаги огурца в разделе выполнения. Кроме того, вложения не привязываются к отчетам.
Я могу сгенерировать отчет Allure на основе шагов, указанных на сайте Allure Тем не менее, я не могу увидеть шаги (учитывая, когда тогда) в разделе выполнения отчета. Кроме того, вложения также не генерируются в отчете.
Фрагмент класса бегуна
@RunWith(Cucumber.class)
@CucumberOptions(features = { "src/test/java/features" },
plugin = { "pretty", "html:target/cucumber-html-reports",
"json:target/cucumber-html-reports/cucumber.json","rerun:target/failed_scenarios.txt" }, monochrome = true, glue = { "definitions" }, tags = {"@SmokeTest"}
)
фрагмент POM
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- <downloadSources>true</downloadSources> <downloadJavadocs>true</downloadJavadocs> -->
<aspectj.version>1.8.10</aspectj.version>
<allureVersion>2.10.0</allureVersion>
<cucumberversion>4.2.0</cucumberversion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
<compilerArgument>-Werror</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<argLine>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" -Dcucumber.options="--plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm" -Xmx1024m -XX:MaxPermSize=256m
</argLine>
<properties>
<property>
<name>listener</name>
<value>io.qameta.allure.junit4.AllureJunit4</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit4</artifactId>
<version>${allureVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber4-jvm</artifactId>
<version>${allureVersion}</version>
</dependency>
<!-- <dependency> <groupId>io.qameta.allure</groupId>
<artifactId>allure-plugin-api</artifactId>
<version>${allureVersion}</version> </dependency> -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumberversion}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumberversion}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumberversion}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumberversion}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>xml-path</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
пример сценария огурца
@SmokeTest
Scenario: multiply a and b
Given I have variable a
And I have variable b
When I multiplication a and b
Then I display the Result
step def
@Given("^I have variable a$")
public void i_have_variable_a() throws Exception {
System.out.println("at step : I have variable a");
}
@Given("^I have variable b$")
public void i_have_variable_b() throws Exception {
System.out.println("at step : I have variable b");
}
@When("^I multiplication a and b$")
public void i_multiplication_a_and_b() throws Exception {
System.out.println("at step : multiplication");
}
@Then("^I display the Result$")
public void i_display_the_Result() throws Exception {
System.out.println("at step : result display");
}
Код вложения - (не используется в приведенном выше примере кода, но используется в реальном коде
@Attachment(fileExtension = "json", type = "text/json", value = "RestJsonResponse")
public String attachResponse(Response strResponse) {
return strResponse.asString();
}
Ожидаемый : Возможность видеть данные заданного тогда утверждения где-то в отчете. Также для просмотра вложений в отчете в виде файлов json.
Фактический : Отчет генерирует, но не дает, когда тогда заявления и нет вложений.