There are several solutions, but no direct one ... they will all include some parsing (XML or text file).
XML reports
, , . Surefire XML target/surefire-reports. XML, . XML XSD .
XML ( ) target/surefire-reports TEST-${testClass}.xml, ${testClass} . my.test.MyTest :
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="my.test.MyTest" tests="4" errors="1" skipped="1" failures="1">
<properties> </properties>
<testcase name="test" classname="my.test.MyTest" time="0.096">
<failure></failure>
</testcase>
<testcase name="test2" classname="my.test.MyTest" time="0.001">
<error></error>
</testcase>
<testcase name="test3" classname="my.test.MyTest" time="0.002"/>
<testcase name="test4" classname="my.test.MyTest" time="0">
<skipped/>
</testcase>
</testsuite>
( , ). , <testsuite> , 4 , 1, 1 1; 1 . , <testcase> name, . 4 :
- (, , ):
<testcase> <failure>. - ( , ):
<testcase> <error>. - skip:
<testcase> <skipped>. - success:
<testcase> .
, classname ( ) name ( ).
Surefire plain reportFormat
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<reportFormat>plain</reportFormat>
</configuration>
</plugin>
:
Running my.test.MyTest
Tests run: 4, Failures: 1, Errors: 1, Skipped: 1, Time elapsed: 0.169 sec <<< FAILURE! - in my.test.MyTest
test(my.test.MyTest) Time elapsed: 0.112 sec <<< FAILURE!
java.lang.AssertionError
at my.test.MyTest.test(my.test.MyTest.java:16)
test2(my.test.MyTest) Time elapsed: 0.001 sec <<< ERROR!
java.lang.IllegalArgumentException: Exception
at my.test.MyTest.test2(my.test.MyTest.java:21)
test3(my.test.MyTest) Time elapsed: 0.002 sec
test4(my.test.MyTest) skipped
, (.*)\((.*)\)\s+(?|(skipped)|Time elapsed:.*<<< (.*)): 1, 2 3 ; 3 , .