testng 集成 allure,运行报错

    科技2023-10-02  91

    项目场景:

    IDEA(JAVA)+testng+allure maven项目

    问题描述:

    报错:Allure report was skipped because there is no results directories found.

    原因分析:

    由于没有运行test方法,导致一直无法生成结果

    解决方案:

    操作问题:导致么有执行 mvn test导致

    mvn clean testmvn io.qameta.allure:allure-maven:serve

    附加: 简单的testng+allure运行pom.xml模板

    <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>mytest</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> <!-- 文件拷贝时的编码 --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <!-- 编译时的编码 --> <maven.compiler.encoding>UTF-8</maven.compiler.encoding> <aspectj.version>1.9.2</aspectj.version> </properties> <dependencies> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>7.0.0</version> <scope>test</scope> </dependency> <dependency> <groupId>io.qameta.allure</groupId> <artifactId>allure-testng</artifactId> <version>2.6.0</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <!-- maven-surefire-plugin 配合testng/junit执行测试用例的maven插件 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> <configuration> <!-- 测试失败后,是否忽略并继续测试 --> <testFailureIgnore>true</testFailureIgnore> <suiteXmlFiles> <!-- testng配置文件名称 --> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> <!--设置参数命令行 --> <argLine> <!-- UTF-8编码 --> -Dfile.encoding=UTF-8 <!-- 配置拦截器 --> -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar" </argLine> <systemProperties> <property> <!-- 配置 allure 结果存储路径 --> <name>allure.results.directory</name> <value>${project.build.directory}/allure-results</value> </property> </systemProperties> </configuration> <dependencies> <!-- aspectjweaver maven坐标 --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</version> </dependency> </dependencies> </plugin> </plugins> </build> </project>

    ------------------------------------------完---------------------------------------------

    Processed: 0.010, SQL: 8