【问题标题】:Allure Test NG report TestBody is missingAllure Testng 报告测试机构丢失
【发布时间】: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);

    }

}

【问题讨论】:

标签: maven automated-tests cucumber testng allure


【解决方案1】:

我在使用 allure-testng v.2.17.0 和 TestNG v.7.5.0 时遇到了这个问题

唯一对我有帮助的是将 TestNG 降级到 7.4.0,之后测试机构开始按应有的方式显示。

所以尝试使用 allure-testng 和 testng 版本来找到兼容的组合

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多