运行测试后,Maven + Jenkins + Testng构建失败

时间:2014-07-21 23:58:06

标签: java maven jenkins testng

我正在对詹金斯进行一系列测试,我得到以下结果:

Tests run: 5, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:39 min
[INFO] Finished at: 2014-07-21T16:33:14-07:00
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.16:test (default-test) on project barcoAutomation: There are test failures.
[ERROR] 
[ERROR] Please refer to C:\Code\Maven\.\Maven\barcoAutomation\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[INFO] Build failures were ignored.
[Maven] $ cmd /c call C:\Windows\TEMP\hudson8319915807901667722.bat

有些东西告诉我这一行:maven-surefire-plugin:2.16就是这里的问题,所以这是我的pom文件供审查:

<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 -->
        <!-- <suiteFile>src/test/resources/barcoColor.xml</suiteFile> <suiteFile>src/test/resources/GeneralSettings.xml</suiteFile> -->
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8</version>
        </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>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <suiteXmlFiles>
                    <suiteXmlFile>src/test/resources/barcoGeneralSettings.xml</suiteXmlFile>
                        <!-- <suiteXmlFile>${suiteFile}</suiteXmlFile> -->
                    </suiteXmlFiles>
                    <!--<suiteXmlFile>src/test/resources/GeneralSettings.xml</suiteXmlFile> 
                        <suiteXmlFiles> <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> 
                        <suiteXmlFile>src/test/resources/NewFile.xml</suiteXmlFile> <suiteXmlFile>src/test/resources/barcoColor.xml</suiteXmlFile> 
                        </suiteXmlFiles> -->
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/test/resources/</directory>
            </resource>
        </resources>
    </build>
</project>

我已经检查了maven repository中的插件,我看到的唯一区别是我在插件标签中有插件,而在网站中它是在dependecy标签中。

这里可能出现什么错误?

由于

注意:对不起纯文本,但我不知道如何在代码上添加颜色= /

1 个答案:

答案 0 :(得分:0)

maven命令成功运行,但是您的5个测试中有一个失败了。

Tests run: 5, Failures: 1, Errors: 0, Skipped: 0

测试失败将导致构建失败&#34;

看看:

C:\Code\Maven\.\Maven\barcoAutomation\target\surefire-reports

看看哪个测试失败了,为什么。

相关问题