【发布时间】:2019-08-20 02:48:07
【问题描述】:
我正面临这个奇怪的问题,即我的 allure testNg 报告未显示测试正文部分。这是我的 Maven 命令
mvn clean test
-DisBrowserStack=true
-DdeviceFlavors="Google Nexus6"
-DdeviceOsFlavors="6.0"
-Dsurefire.suiteXmlFiles="testng.xml"
这是我的 pom 文件:我还附上了报告截图,问题是它不包括 TestBody 段。
http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 cucumber.framework cucumber.framework 1.0 罐子
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mavencompiler.version>3.6.0</mavencompiler.version>
<mavensurefire.version>2.21.0</mavensurefire.version>
<cucumber.version>4.3.1</cucumber.version>
<appium.version>7.0.0</appium.version>
<junit.version>4.12</junit.version>
<aspectj.version>1.9.4</aspectj.version>
<allure.version>2.12.0</allure.version>
<jetty.version>9.2.10.v20150310</jetty.version>
<jackson.version>2.9.0</jackson.version>
<httpclient.version>1.22.0</httpclient.version>
<okhttp.version>3.11.0</okhttp.version>
<json.version>20170516</json.version>
<hamcrest.version>1.3</hamcrest.version>
<springjdbc.version>5.1.3.RELEASE</springjdbc.version>
<postgresql.version>42.1.4</postgresql.version>
<jaxb.version>2.3.0</jaxb.version>
<javaxactivation.version>1.1.1</javaxactivation.version>
<cucumbertestng.version>4.3.1</cucumbertestng.version>
<testng.version>6.14.3</testng.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${mavencompiler.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mavensurefire.version}</version>
<configuration>
<includes>
<include>**/${TEST_NAME}RunnerTest.java</include>
</includes>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<properties>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<webAppSourceDirectory>${project.build.directory}/site/allure-maven-plugin</webAppSourceDirectory>
<stopKey>stop</stopKey>
<stopPort>1234</stopPort>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>${appium.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber4-jvm</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${springjdbc.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${javaxactivation.version}</version>
</dependency>
<!-- All Test NG stuff-->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumbertestng.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.version}</version>
</dependency>
</dependencies>
这是 Cucumber runner 文件
package cucumber.mobile;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;
import device.Device;
import device.DeviceFactory;
@CucumberOptions(plugin = { "pretty", "json:target/cucumber-report.json","junit:TEST-all.xml",
"html:target/html/"}, features = "src/test/resources/features/SignUp.feature" ,glue = { "steps" }, tags = { "@Mobile" })
public class ParallelRunner extends AbstractTestNGCucumberTests {
@BeforeTest
@Parameters({ "deviceName", "platformVersion" })
public void executeParallelTests(String deviceName, String platformVersion) {
Device device = new Device();
device.setDeviceName(deviceName);
device.setOsVersion(platformVersion);
DeviceFactory.setDevice(device);
}
}
【问题讨论】:
-
有人知道如何解决这个问题吗?
-
嗯。似乎是 allure-testng 中的一个错误我发现了这个我不确定这个问题的状态是什么。它已经挂在那里一段时间了。 github.com/allure-framework/allure-java/issues/301
标签: maven automated-tests cucumber testng allure