Jenkins Publish TestNG Results not working

11,773

Eventually I found out that I need to use forward slash for TestNG plugin to locate the file (My Jenkins runs on Windows).

TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: C:/workspace/project/target/surefire-reports/Suite1/UnitTests.xml;C:/workspace/project/target/surefire-reports/Suite2/UnitTests.xml
Saving reports...
Processing 'C:\programs\Jenkins\jobs\project\builds\2014-10-02_21-57-48\testng\testng-results-1.xml'
Processing 'C:\programs\Jenkins\jobs\project\builds\2014-10-02_21-57-48\testng\testng-results.xml'
TestNG Reports Processing: FINISH
Finished: SUCCESS

Also this reference helped: http://www.seleniumtests.com/p/testing-forum.html#nabble-td5001883

Share:
11,773
CoolDude
Author by

CoolDude

Updated on July 25, 2022

Comments

  • CoolDude
    CoolDude almost 2 years

    I am running Jenkins 1.571. I am building my project with a pom.xml. I have two executions of maven-surefire-plugin to execute two testng suites in a forked mode.

    But Jenkins build#/testReport page shows test results for only first suite. Build logs show test cases from both suites are successfully executed.

    I want to include results from both suites into report, so I added Publish TestNG Results plug-in, but that doesn't show any results at all. Any idea on what I might be missing?

    In my Jenkins configuration, I specified 'TestNG XML report pattern' = '**/target/surefire-reports/testng-results.xml'

    Build log shows:

    TestNG Reports Processing: START
    Looking for TestNG results report in workspace using pattern: **/target/surefire-reports/testng-results.xml
    Did not find any matching files.
    Finished: SUCCESS
    

    My relevant pom.xml:

    <!-- run unit test cases -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <configuration>
            <environmentVariables>
                <outputDirectory>${project.build.directory}</outputDirectory>
            </environmentVariables>
        </configuration>
        <executions>
            <execution>
                <id>default-test</id>
                <configuration>
                    <forkMode>once</forkMode>
                    <suiteXmlFiles>
                        <suiteXmlFile>${basedir}/src/test/testngSuite1.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </execution>
            <execution>
                <id>special-test</id>
                <phase>test</phase>
                <goals>
                    <goal>test</goal>
                </goals>
                <configuration>
                    <forkMode>always</forkMode>
                    <suiteXmlFiles>
                        <suiteXmlFile>${basedir}/src/test/testngSuite2.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </execution>
        </executions>
    </plugin>