测试特定的测试套件xml文件在Netbeans上无法正常工作

时间:2019-03-23 20:45:42

标签: netbeans testng

如果我做错了什么还是一个错误,并且我正在谈论testng测试套件xml文件,您能解释一下吗?

每当我创建testng类和几个@Test方法并且想要测试此类时,我都会从上下文菜单中选择选项“测试文件”,或者在活动的Java类上按Ctrl + F6。 (屏幕截图:testFileJava.png),并且工作正常(仅对给定类内部的方法运行测试

但是... 每当我创建testNG测试套件xml文件并尝试“测试文件”这样的xml测试套件时,它只是根本不执行/不识别/不解析该xml文件,并且它不执行此类测试套件(附件:TestNgSpecificTestSuite.png,TestNgSpecificTestSuite。日志)enter image description here  在日志文件上,您可以看到其他一些类正在运行,而不是在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没有正确处理特定的测试套件文件(执行特定的testng xml测试套件可能会出现问题...)

顺便说一句:在surefire插件中明确声明<suiteXmlFile>并通过maven命令运行它,例如mvn clean install可以正常运行并执行在surefire插件配置上声明的特定测试套件。

任何想法,这是怎么回事?

0 个答案:

没有答案