Surefire报告不显示测试结果

时间:2016-10-06 05:58:30

标签: java maven testng surefire

我已经使用maven配置了surefire报告

我没有收到任何错误,但我也没有得到测试执行结果 当作为Maven测试时运行。我附上了截图。我也有适当的Maven项目结构

以Maven测试运行时显示以下日志

[INFO] Scanning for projects...[![enter image description here][1]][1]
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building TestApp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/testng/testng/maven-metadata.xml
[INFO] Downloaded: http://repo.maven.apache.org/maven2/org/testng/testng/maven-metadata.xml (3 KB at 1.0 KB/sec)
[WARNING] The POM for org.testng:testng:jar:5.14.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.testng:testng:jar:5.14.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.testng:testng:jar:5.14.5 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ TestApp ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ TestApp ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ TestApp ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Workspace_Test\TestApp\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ TestApp ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ TestApp ---
[INFO] Surefire report directory: E:\Workspace_Test\TestApp\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.goibibo.tests.Tests
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@512ddf17
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 56.983 sec

Results :

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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:05 min
[INFO] Finished at: 2016-10-06T11:20:23+05:30
[INFO] Final Memory: 12M/158M
[INFO] ------------------------------------------------------------------------

还可以找到maven项目结构和enter image description here报告截图

的附加屏幕截图

pom.xml文件如下

<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>TestApp</groupId>
    <artifactId>TestApp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
<!--    <sourceDirectory>src</sourceDirectory>-->
        <resources>
            <resource>
                <directory>Data</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>

            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                    <configuration>
                        <fork>true</fork>
                        <executable>C:\Program Files\Java\jdk1.8.0_101\bin\javac.exe</executable>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>


                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-report-plugin</artifactId>
                    <version>2.19.1</version>
                    <configuration>
                        <!-- <reportsDirectory>>${test.results.dir}/${run.time}</reportsDirectory> -->
                        <outputDirectory>${basedir}/target/surefire-reports/</outputDirectory>
                    </configuration>
                    <!-- <executions> <execution> <phase>test</phase> <goals> <goal>report-only</goal> 
                        </goals> </execution> </executions> -->
                </plugin>

            </plugins>

            </build>
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.53.1</version>
        </dependency>
        <dependency>
            <groupId>org.uncommons</groupId>
            <artifactId>reportng</artifactId>
            <version>1.1.4</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.9.10</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <scope>compile</scope>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>compile</scope>
            <version>2.7</version>
        </dependency>
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <scope>compile</scope>
            <version>2.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <scope>compile</scope>
            <version>1.7</version>
        </dependency>
    </dependencies>
</project>

1 个答案:

答案 0 :(得分:0)

如果您使用TestNG,本文可能会对您有所帮助:

https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html