为什么JUnit测试在初始JVM和分叉JVM中运行?

时间:2012-01-06 14:55:28

标签: ant junit jvm

初始JVM和分叉JVM的两个堆栈下面似乎说测试代码执行了两次而不是一次。我想知道为什么它不仅仅是在分叉的那个中执行。

JUnit test config:fork = true,for kmode = perTest

at oracle.security.jps.internal.policystore.PolicyUtil.getPDPService(PolicyUtil.java:3099)
at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:164)
at oracle.security.jps.internal.policystore.JavaPolicyProvider.<init>(JavaPolicyProvider.java:369)
at oracle.security.jps.service.policystore.PolicyStoreTestCaseBase.<init>(PolicyStoreTestCaseBase.java:39)
at oracle.security.jps.service.policystore.JpsJavaPolicyPreTestCase.<init>(JpsJavaPolicyPreTestCase.java:145)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at junit.framework.TestSuite.createTest(TestSuite.java:65)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:283)
at junit.framework.TestSuite.<init>(TestSuite.java:146)
at oracle.security.jps.service.policystore.JpsJavaPolicyPreTestCase.suite(JpsJavaPolicyPreTestCase.java:603)
at devtest.JpsUnitPreTestSuite.suite(JpsUnitPreTestSuite.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testlogic.testrunner.ant.junit4.JUnitTestRunner.createTestSuite(JUnitTestRunner.java:929)
at org.testlogic.testrunner.ant.junit4.TLJUnitTestRunner.createTestSuite(TLJUnitTestRunner.java:217)
at org.testlogic.testrunner.ant.junit4.JUnitTestRunner.run(JUnitTestRunner.java:366)
at org.testlogic.testrunner.ant.junit4.TLJUnitTestRunner.run(TLJUnitTestRunner.java:111)
at org.testlogic.testrunner.ant.junit4.JUnitTask.runTestInVM(JUnitTask.java:1319)
at org.testlogic.testrunner.ant.junit4.TLJUnitTask.runInitMode(TLJUnitTask.java:327)
at org.testlogic.testrunner.ant.junit4.TLJUnitTask.run(TLJUnitTask.java:120)
at org.testlogic.impl.ant.JITInitModeListener.runTestTaskInInitMode(JITInitModeListener.java:91)
at org.testlogic.impl.ant.JITInitModeListener.taskStarted(JITInitModeListener.java:121)
at org.apache.tools.ant.Project.fireTaskStarted(Project.java:2131)
at org.apache.tools.ant.Task.perform(Task.java:345)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1307)
at org.testlogic.impl.ant.AntTaskUtils.simulateAntCall(AntTaskUtils.java:273)
at org.testlogic.impl.ant.executionPlan.model.CommandRunnable.runCommand(CommandRunnable.java:178)
at org.testlogic.impl.ant.executionPlan.model.CommandRunnable.run(CommandRunnable.java:105)
at java.lang.Thread.run(Thread.java:662)

and

at oracle.security.jps.internal.policystore.PolicyUtil.getPDPService(PolicyUtil.java:3099)
at oracle.security.jps.internal.policystore.PolicyDelegationController.<init>(PolicyDelegationController.java:164)
at oracle.security.jps.internal.policystore.JavaPolicyProvider.<init>(JavaPolicyProvider.java:369)
at oracle.security.jps.service.policystore.PolicyStoreTestCaseBase.<init>(PolicyStoreTestCaseBase.java:39)
at oracle.security.jps.service.policystore.JpsJavaPolicyPreTestCase.<init>(JpsJavaPolicyPreTestCase.java:145)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at junit.framework.TestSuite.createTest(TestSuite.java:65)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:283)
at junit.framework.TestSuite.<init>(TestSuite.java:146)
at oracle.security.jps.service.policystore.JpsJavaPolicyPreTestCase.suite(JpsJavaPolicyPreTestCase.java:603)
at devtest.JpsUnitPreTestSuite.suite(JpsUnitPreTestSuite.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testlogic.testrunner.ant.junit4.JUnitTestRunner.createTestSuite(JUnitTestRunner.java:929)
at org.testlogic.testrunner.ant.junit4.TLJUnitTestRunner.createTestSuite(TLJUnitTestRunner.java:217)
at org.testlogic.testrunner.ant.junit4.JUnitTestRunner.run(JUnitTestRunner.java:366)
at org.testlogic.testrunner.ant.junit4.TLJUnitTestRunner.run(TLJUnitTestRunner.java:111)
at org.testlogic.testrunner.ant.junit4.JUnitTestRunner.launch(JUnitTestRunner.java:869)
at org.testlogic.testrunner.ant.junit4.JUnitTestRunner.main(JUnitTestRunner.java:714)
at org.testlogic.testrunner.ant.junit4.TLJUnitTestRunner.main(TLJUnitTestRunner.java:209)

build.xml中的JUnit部分

         

<!-- Run in its own JVM.  todir="${test.results.dir}" -->
<test todir="${test.results.dir}" name="devtest.JpsUnitPreTestSuite" unless="jps.testcase"/>
<!-- Followed by these tests. -->
<test todir="${test.results.dir}" name="devtest.JpsUnitTestSuite" unless="jps.testcase"/>
<!-- JVM system properties -->
<sysproperty key="src.home" value="${env.ADE_VIEW_ROOT}"/>
<sysproperty key="ant.home" value="${ant.home}"/>
    ...

0 个答案:

没有答案