接口测试 请问 Jenkins 中怎么配置测试报告为 maven-surefire-plugin 插件生成的 html 报告?

初晓 · 2017年07月24日 · 最后由 初晓 回复于 2017年07月25日 · 1693 次阅读

【如题】
我使用 maven+testNG 来搞接口测试,其中测试报告插件使用 maven-surefire-plugin 来生成

但是将项目在 Jenkins 上构建后,必须得自己到工作空间 /tartget/surefire-reports/html/overview.html(其中 index.html 查看为空)查看

我想将 /tartget/surefire-reports/html/index.html 作为的默认报告

请问怎么来设置?

感谢!

配置如下

    <plugins>
        <!-- 添加插件 关联testNg.xml -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <!-- <type>maven-plugin</type> -->
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>src/test/resources/${xmlFileName}</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>

        <!-- 添加插件,添加ReportNg的监听器,修改最后的TestNg的报告 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
                <properties>
                    <property>
                        <name>usedefaultlisteners</name>
                        <value>false</value>
                    </property>
                    <property>
                        <name>listener</name>
                        <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
                    </property>
                </properties>
                <workingDirectory>target/</workingDirectory>
                <!-- <forkMode>always</forkMode> -->
                <argLine>-Dfile.encoding=UTF-8</argLine>
            </configuration>
        </plugin>
    </plugins>
</build>
共收到 4 条回复 时间 点赞
白纸 回复

感谢,目前还没研究 allure, 不过我马上也要学习一下。


在构建后操作里添加 HTML directory to archive 填上你生成的 overview.html 地址就好了

韩将 回复

哦, 原来是这样。 非常感谢!

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册