Не могли бы вы объяснить, если я что-то делаю неправильно или это ошибка, и я рассказываю о xml-файле testng комплекта тестов.
Всякий раз, когда я создаю класс testng и пару методов @Test иЯ хочу протестировать такой класс, я выбираю опцию «Тестовый файл» либо из контекстного меню, либо нажав Ctrl + F6 на активном Java-классе.(снимок экрана: testFileJava.png) и он отлично работает (он запускает тесты только для методов, которые находятся внутри данного класса
, но ... Всякий раз, когда я создаю testNG xml файл комплекта тестови чтобы попытаться «Тестировать файл», такой набор тестов xml просто не выполняет / не распознает / не анализирует этот файл xml и не выполняет такой набор тестов (attachment: TestNgSpecificTestSuite.png, TestNgSpecificTestSuite.log) в файле журнала вы можете видеть, что запущены некоторые другие классы, а не те, которые объявлены в наборе тестов xml ...
cd D:\DEV\netbeans10_workspace\TestNG_Project; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_201" M2_HOME=D:\\DEV\\apache-maven-3.6.0 cmd /c "\"\"D:\\DEV\\apache-maven-3.6.0\\bin\\mvn.cmd\" -Dnetbeans.testng.action=true -Dmaven.ext.class.path=D:\\DEV\\netbeans10\\java\\maven-nblib\\netbeans-eventspy.jar -Dfile.encoding=UTF-8 test-compile surefire:test\""
Scanning for projects...
-----------------------< com.bsc:TestNG_Project >-----------------------
Building TestNG_Project 1.0-SNAPSHOT
--------------------------------[ jar ]---------------------------------
--- maven-resources-plugin:2.6:resources (default-resources) @ TestNG_Project ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 0 resource
--- maven-compiler-plugin:3.1:compile (default-compile) @ TestNG_Project ---
Nothing to compile - all classes are up to date
--- maven-resources-plugin:2.6:testResources (default-testResources) @ TestNG_Project ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 2 resources
--- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ TestNG_Project ---
Nothing to compile - all classes are up to date
--- maven-surefire-plugin:3.0.0-M3:test (default-cli) @ TestNG_Project ---
file.encoding cannot be set as system property, use <argLine>-Dfile.encoding=...</argLine> instead
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Results:
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.623 s
Finished at: 2019-03-23T20:52:34+01:00
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-cli) on project TestNG_Project: There are test failures.
Please refer to D:\DEV\netbeans10_workspace\TestNG_Project\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
There was an error in the forked process
No free nodes found in:[DynamicGraph
Ready:[TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2], TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2], TestNGClass1Test.testMethod11()[pri:0, instance:tests.TestNGClass1Test@3cda1055], TestNGClass1Test.testMethod12()[pri:0, instance:tests.TestNGClass1Test@3cda1055], TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc], TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc], TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]]
Running:[]
Finished:[]
Edges:
TestNGClass1Test.testMethod12()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass1Test.testMethod11()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass1Test.testMethod12()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass1Test.testMethod11()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
]
org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
No free nodes found in:[DynamicGraph
Ready:[TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2], TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2], TestNGClass1Test.testMethod11()[pri:0, instance:tests.TestNGClass1Test@3cda1055], TestNGClass1Test.testMethod12()[pri:0, instance:tests.TestNGClass1Test@3cda1055], TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc], TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc], TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]]
Running:[]
Finished:[]
Edges:
TestNGClass1Test.testMethod12()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass1Test.testMethod11()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass1Test.testMethod12()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass2Test.testMethod21()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass1Test.testMethod11()[pri:0, instance:tests.TestNGClass1Test@3cda1055]
TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass2Test.testMethod22()[pri:0, instance:tests.TestNGClass2Test@3b81a1bc]
TestNGClass3Test.testMethod31()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod32()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
TestNGClass3Test.testMethod33()[pri:0, instance:tests.TestNGClass3Test@64616ca2]
]
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:657)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1161)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1002)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:848)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
-> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
я делаю что-то не так или это не NetBeans, который не обрабатываетправильные файлы определенного набора тестов (может быть, проблема с выполнением определенных наборов тестовых тестов xml ...)
Кстати: явно объявить <suiteXmlFile>
в плагине surefire и запустить его из команды maven, например, mvn clean install работает нормально ивыполняет определенный набор тестов, объявленный в конфигурации плагина surefire.
Есть идеи, что с этим происходит?