Вроде разобрался что нужно писать.
package ru.minicom.itphone.client; import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; public class RunTests { public static void main(String[] args){ Result result = JUnitCore.runClasses(LoginPageTest.class); System.out.println("Total number of tests " + result.getRunCount()); System.out.println("Total number of test failed " + result.getFailureCount()); for(Failure failure : result.getFailures()){ System.out.println(failure.getMessage()); } System.out.println(result.wasSuccessful()); } }
В pom.xml пописал
<configuration> <archive> <manifest> <mainClass>ru.minicom.itphone.client.RunTests</mainClass> </manifest> </archive> </configuration>
Но при компиляции теперь ругается
D:\Project\ITPhone_Firelink\ver.8.0\Tests\ClientTest>mvn compile [INFO] Scanning for projects... [INFO] [INFO] ------------< TestITPhoneClient:ru.minicom.itphone.client >------------- [INFO] Building TestITPhoneClient 1.0 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ru.minicom.itphone.client --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 10 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ ru.minicom.itphone.client --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 5 source files to D:\Project\ITPhone_Firelink\ver.8.0\Tests\ClientTest\target\classes [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.158 s [INFO] Finished at: 2019-06-25T16:53:34+03:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project ru.minicom.itphone.client: Fatal error compiling: invalid flag: --release -> [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/MojoExecutionException