如何设置TestNG + Jenkins [英] How to set up TestNG+Jenkins

查看:163
本文介绍了如何设置TestNG + Jenkins的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Jenkins运行一些testNG测试,当构建完成后,我在最后收到以下消息:

I'm using Jenkins to run some testNG test, when the build is finished i get the following message at the end:

[INFO] Build failures were ignored.
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/test-output/testng-result.xml
Did not find any matching files.
Finished: SUCCESS

我查看了Jenkins的工作区,没有名为test的文件夹-output,这里的问题是,如何告诉jenkins创建包含结果的文件夹?

I looked at the workspace in Jenkins and there is no folder named test-output, the question here is, how do I tell jenkins to create the folder with the results in there?

如果需要,这是我的pom.xml:

Here is my pom.xml if needed:

<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>com.barco.automation</groupId>
    <artifactId>barcoAutomation</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>barcoAutomation</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <!-- added -->
    </properties>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.uncommons</groupId>
            <artifactId>reportng</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.42.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.10-FINAL</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.10-FINAL</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>My Automated tests</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

谢谢

推荐答案

我建议你使用 HTML Report Publisher Plugin 在Jenkins插件中并按如下方式配置您的报告。这将允许您查看每个构建的报告。通过这种方式,您将能够以明智的方式存档所有testNG报告,并且也可以在作业级别上查看。安装此插件后,配置作业并添加POST-BUILD-STEP(以启用HTML REPORT PUBLISHER)并按照testNG报告的位置设置进行操作。如有任何问题,请参阅下面的屏幕截图并告诉我。希望这会有所帮助!

I will recommend you to use HTML Report Publisher Plugin in Jenkins addon and configure your reports as below. This will allow you to view the report for every build. Through this you will be able to archive all your testNG reports build wise and it can be seen on the Job level as well. Once you are installing this plugin, configure your job and add a POST-BUILD-STEP (to enable the HTML REPORT PUBLISHER) and follow the location setting for testNG reports. Please refer to the screenshot below and let me know in case of any questions. Hope this helps!

通常,您在此处生成的TestNG报告:

Typically, your TestNG reports generated here :

<Jenkins-Location>\jobs\<JOB_NAME>\workspace\target\html

这篇关于如何设置TestNG + Jenkins的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆