【问题标题】:io.qameta.allure.testng.AllureTestNg could not be instantiatedio.qameta.allure.testng.AllureTestNg 无法实例化
【发布时间】:2018-12-04 12:20:40
【问题描述】:

每次我在代码中运行测试时都会收到此消息

org.testng.ITestNGListener: Provider io.qameta.allure.testng.AllureTestNg 
could not be instantiated.

我已经使用了 testNG 并且我更新了 allure 和 testng 的最新版本。

1.8.10

           <build>
                <plugins>
                    <plugin>


              <groupId> org.apache.maven.plugins </groupId>
                        <artifactId> maven-surefire-plugin </artifactId>
                        <version>2.20</version>

         <configuration>
                            <suiteXmlFiles>
                                <suiteXmlFile>testng.xml</suiteXmlFile>
                            </suiteXmlFiles>
                            <argLine>
                                -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                            </argLine>
                            <groups/>

                        </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.aspectj</groupId>
                            <artifactId>aspectjweaver</artifactId>
                            <version>${aspectj.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.2</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </build>

 <dependencies>

          <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20080701</version>
        </dependency>

  <dependency> /* testng */
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.13.1</version>
         </dependency>

 <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>

  <dependency> /* allure testng */
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-testng</artifactId>
            <version>2.6.0</version>
        </dependency>

        <dependency> 
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>


    </dependencies>  
</project>

我错过了一些依赖项? 我想用这个工具创建报告,我只有这个工具的安装卡住了。 我还在一些程序员的建议中添加了 javax.xml.bind ,但它仍然不起作用。 顺便说一句,我打开了一个新项目,并且诱惑效果很好。

感谢您的帮助!

【问题讨论】:

  • 我也有这个问题。当我添加 \@Step 测试不起作用。但使用 \@Story 和 \@Feature 标签 工作正常

标签: java xml maven testng allure


【解决方案1】:

尝试将 allure-testng 依赖项从 2.6.0 更改为 2.7.0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-03
    • 2016-06-09
    • 2020-10-26
    • 2016-11-22
    • 2016-02-29
    • 2017-01-29
    • 2020-08-30
    • 2011-02-28
    相关资源
    最近更新 更多