我在 Windows XP 上使用 IntelliJ Idea 11.1.1(据我所知的最新版本),由于某种原因,我无法在 Idea 中运行一个 JUnit 测试用例(方法)。
当我运行整个单元测试类时,每个测试都显示为“通过”。
http://zone8.dk/stackoverflow/ideajunit1.png
但是.. 当我将光标放在其中一个测试用例方法中并按 CTRL+SHIFT+F10 单独运行此特定测试用例时,测试无法执行。
http://zone8.dk/stackoverflow/ideajunit2.png
这是整个 IDEA 控制台输出:
"C:\Program Files\Java\jdk1.6.0_31\bin\java" -ea -Didea.launcher.port=7548 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 11.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 11.1.1\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 11.1.1\plugins\junit\lib\junit-rt.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\jce.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\resources.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.6.0_31\jre\lib\ext\sunpkcs11.jar;C:\cygwin\home\jot\netbutikken\model\target\test-classes;C:\cygwin\home\jot\netbutikken\model\target\classes;C:\maven-repository\tapestry\tapestry\4.0.2\tapestry-4.0.2.jar;C:\maven-repository\jboss\javassist\3.0\javassist-3.0.jar;C:\maven-repository\commons-codec\commons-codec\1.3\commons-codec-1.3.jar;C:\maven-repository\commons-fileupload\commons-fileupload\1.1\commons-fileupload-1.1.jar;C:\maven-repository\commons-io\commons-io\1.4\commons-io-1.4.jar;C:\maven-repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\maven-repository\ognl\ognl\2.6.7\ognl-2.6.7.jar;C:\maven-repository\oro\oro\2.0.8\oro-2.0.8.jar;C:\maven-repository\hivemind\hivemind\1.1.1\hivemind-1.1.1.jar;C:\maven-repository\hivemind\hivemind-lib\1.1.1\hivemind-lib-1.1.1.jar;C:\maven-repository\org\apache\axis2\axis2\1.5.1\axis2-1.5.1.jar;C:\maven-repository\org\apache\axis2\axis2-transport-local\1.5.1\axis2-transport-local-1.5.1.jar;C:\maven-repository\org\apache\axis2\axis2-kernel\1.5.1\axis2-kernel-1.5.1.jar;C:\maven-repository\org\apache\ws\commons\axiom\axiom-api\1.2.8\axiom-api-1.2.8.jar;C:\maven-repository\org\apache\geronimo\specs\geronimo-activation_1.1_spec\1.0.1\geronimo-activation_1.1_spec-1.0.1.jar;C:\maven-repository\org\apache\geronimo\specs\geronimo-javamail_1.4_spec\1.2\geronimo-javamail_1.4_spec-1.2.jar;C:\maven-repository\jaxen\jaxen\1.1.1\jaxen-1.1.1.jar;C:\maven-repository\org\apache\geronimo\specs\geronimo-stax-api_1.0_spec\1.0.1\geronimo-stax-api_1.0_spec-1.0.1.jar;C:\maven-repository\org\apache\ws\commons\axiom\axiom-impl\1.2.8\axiom-impl-1.2.8.jar;C:\maven-repository\org\codehaus\woodstox\wstx-asl\3.2.4\wstx-asl-3.2.4.jar;C:\maven-repository\org\apache\ws\commons\axiom\axiom-dom\1.2.8\axiom-dom-1.2.8.jar;C:\maven-repository\org\apache\geronimo\specs\geronimo-ws-metadata_2.0_spec\1.1.2\geronimo-ws-metadata_2.0_spec-1.1.2.jar;C:\maven-repository\org\apache\geronimo\specs\geronimo-jta_1.1_spec\1.1\geronimo-jta_1.1_spec-1.1.jar;C:\maven-repository\javax\servlet\servlet-api\2.4\servlet-api-2.4.jar;C:\maven-repository\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;C:\maven-repository\wsdl4j\wsdl4j\1.6.2\wsdl4j-1.6.2.jar;C:\maven-repository\org\apache\ws\commons\schema\XmlSchema\1.4.3\XmlSchema-1.4.3.jar;C:\maven-repository\org\apache\neethi\neethi\2.0.4\neethi-2.0.4.jar;C:\maven-repository\org\apache\woden\woden-api\1.0M8\woden-api-1.0M8.jar;C:\maven-repository\org\apache\ant\ant\1.7.0\ant-1.7.0.jar;C:\maven-repository\org\apache\ant\ant-launcher\1.7.0\ant-launcher-1.7.0.jar;C:\maven-repository\xerces\xmlParserAPIs\2.6.0\xmlParserAPIs-2.6.0.jar;C:\maven-repository\org\apache\woden\woden-impl-dom\1.0M8\woden-impl-dom-1.0M8.jar;C:\maven-repository\javax\mail\mail\1.4\mail-1.4.jar;C:\maven-repository\javax\activation\activation\1.1\activation-1.1.jar;C:\maven-repository\xalan\xalan\2.7.0\xalan-2.7.0.jar;C:\maven-repository\xerces\xercesImpl\2.8.1\xercesImpl-2.8.1.jar;C:\maven-repository\xml-apis\xml-apis\1.3.03\xml-apis-1.3.03.jar;C:\maven-repository\org\apache\axis2\axis2-transport-http\1.5.1\axis2-transport-http-1.5.1.jar;C:\maven-repository\org\apache\httpcomponents\httpcore\4.0\httpcore-4.0.jar;C:\maven-repository\axis\axis\1.4\axis-1.4.jar;C:\maven-repository\axis\axis-jaxrpc\1.4\axis-jaxrpc-1.4.jar;C:\maven-repository\axis\axis-saaj\1.4\axis-saaj-1.4.jar;C:\maven-repository\axis\axis-wsdl4j\1.5.1\axis-wsdl4j-1.5.1.jar;C:\maven-repository\commons-discovery\commons-discovery\0.2\commons-discovery-0.2.jar;C:\maven-repository\org\apache\xmlbeans\xmlbeans\2.4.0\xmlbeans-2.4.0.jar;C:\maven-repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;C:\maven-repository\org\apache\xmlbeans\xmlbeans-xpath\2.4.0\xmlbeans-xpath-2.4.0.jar;C:\maven-repository\net\sf\saxon\saxon\9\saxon-9.jar;C:\maven-repository\net\sf\saxon\saxon-dom\9\saxon-dom-9.jar;C:\maven-repository\net\sf\saxon\saxon-xpath\9\saxon-xpath-9.jar;C:\maven-repository\net\sf\saxon\saxon-s9api\9\saxon-s9api-9.jar;C:\maven-repository\org\hibernate\hibernate\3.2.7.ga\hibernate-3.2.7.ga.jar;C:\maven-repository\net\sf\ehcache\ehcache\1.2.3\ehcache-1.2.3.jar;C:\maven-repository\commons-collections\commons-collections\2.1.1\commons-collections-2.1.1.jar;C:\maven-repository\javax\transaction\jta\1.0.1B\jta-1.0.1B.jar;C:\maven-repository\asm\asm-attrs\1.5.3\asm-attrs-1.5.3.jar;C:\maven-repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\maven-repository\antlr\antlr\2.7.6\antlr-2.7.6.jar;C:\maven-repository\cglib\cglib\2.1_3\cglib-2.1_3.jar;C:\maven-repository\asm\asm\1.5.3\asm-1.5.3.jar;C:\maven-repository\dk\test\rosa\rosa-netbutikken\4.25.22\rosa-netbutikken-4.25.22.jar;C:\maven-repository\joda-time\joda-time\1.6\joda-time-1.6.jar;C:\maven-repository\com\thoughtworks\xstream\xstream\1.2.2\xstream-1.2.2.jar;C:\maven-repository\xpp3\xpp3_min\1.1.3.4.O\xpp3_min-1.1.3.4.O.jar;C:\maven-repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar;C:\maven-repository\velocity\velocity\1.4\velocity-1.4.jar;C:\maven-repository\velocity\velocity-dep\1.4\velocity-dep-1.4.jar;C:\maven-repository\commons-pool\commons-pool\1.5.4\commons-pool-1.5.4.jar;C:\maven-repository\org\apache\xmlgraphics\fop\0.95\fop-0.95.jar;C:\maven-repository\org\apache\xmlgraphics\xmlgraphics-commons\1.3.1\xmlgraphics-commons-1.3.1.jar;C:\maven-repository\org\apache\xmlgraphics\batik-svg-dom\1.7\batik-svg-dom-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-anim\1.7\batik-anim-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-awt-util\1.7\batik-awt-util-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-util\1.7\batik-util-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-dom\1.7\batik-dom-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-css\1.7\batik-css-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-ext\1.7\batik-ext-1.7.jar;C:\maven-repository\xml-apis\xml-apis-ext\1.3.04\xml-apis-ext-1.3.04.jar;C:\maven-repository\org\apache\xmlgraphics\batik-xml\1.7\batik-xml-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-parser\1.7\batik-parser-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-bridge\1.7\batik-bridge-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-gvt\1.7\batik-gvt-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-script\1.7\batik-script-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-transcoder\1.7\batik-transcoder-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-svggen\1.7\batik-svggen-1.7.jar;C:\maven-repository\org\apache\xmlgraphics\batik-extension\1.7\batik-extension-1.7.jar;C:\maven-repository\org\apache\avalon\framework\avalon-framework-api\4.3.1\avalon-framework-api-4.3.1.jar;C:\maven-repository\org\apache\avalon\framework\avalon-framework-impl\4.3.1\avalon-framework-impl-4.3.1.jar;C:\maven-repository\com\java4less\raztec\1.0\raztec-1.0.jar;C:\maven-repository\com\java4less\rbarcode\1.0\rbarcode-1.0.jar;C:\maven-repository\com\google\inject\guice\3.0\guice-3.0.jar;C:\maven-repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\maven-repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\maven-repository\org\easymock\easymock\3.0\easymock-3.0.jar;C:\maven-repository\cglib\cglib-nodep\2.2\cglib-nodep-2.2.jar;C:\maven-repository\org\objenesis\objenesis\1.2\objenesis-1.2.jar;C:\maven-repository\org\jmock\jmock-legacy\2.2.0\jmock-legacy-2.2.0.jar;C:\maven-repository\org\jmock\jmock\2.2.0\jmock-2.2.0.jar;C:\maven-repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;C:\maven-repository\org\hamcrest\hamcrest-library\1.1\hamcrest-library-1.1.jar;C:\maven-repository\com\googlecode\juniversalchardet\juniversalchardet\1.0.3\juniversalchardet-1.0.3.jar;C:\maven-repository\ojdbc\ojdbc\14\ojdbc-14.jar;C:\maven-repository\hsqldb\hsqldb\1.8.0.7\hsqldb-1.8.0.7.jar;C:\maven-repository\com\lowagie\itext\2.1.7\itext-2.1.7.jar;C:\maven-repository\bouncycastle\bcmail-jdk14\138\bcmail-jdk14-138.jar;C:\maven-repository\bouncycastle\bcprov-jdk14\138\bcprov-jdk14-138.jar;C:\maven-repository\org\bouncycastle\bctsp-jdk14\1.38\bctsp-jdk14-1.38.jar;C:\maven-repository\org\bouncycastle\bcprov-jdk14\1.38\bcprov-jdk14-1.38.jar;C:\maven-repository\org\bouncycastle\bcmail-jdk14\1.38\bcmail-jdk14-1.38.jar;C:\maven-repository\info\cukes\cucumber-java\1.0.0\cucumber-java-1.0.0.jar;C:\maven-repository\info\cukes\cucumber-core\1.0.0\cucumber-core-1.0.0.jar;C:\maven-repository\info\cukes\gherkin\2.9.3\gherkin-2.9.3.jar;C:\maven-repository\info\cukes\cucumber-html\0.2.1\cucumber-html-0.2.1.jar;C:\maven-repository\info\cukes\cucumber-junit\1.0.0\cucumber-junit-1.0.0.jar;C:\maven-repository\info\cukes\cucumber-guice\1.0.0\cucumber-guice-1.0.0.jar;C:\maven-repository\junit\junit\4.7\junit-4.7.jar;C:\maven-repository\org\slf4j\jcl-over-slf4j\1.6.1\jcl-over-slf4j-1.6.1.jar;C:\maven-repository\org\slf4j\slf4j-api\1.6.1\slf4j-api-1.6.1.jar;C:\maven-repository\org\slf4j\slf4j-log4j12\1.6.1\slf4j-log4j12-1.6.1.jar;C:\maven-repository\log4j\log4j\1.2.16\log4j-1.2.16.jar;C:\maven-repository\dk\test\log4j\testLog4jSetup\0.1\testLog4jSetup-0.1.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 dk.test.salg.netbutikken.model.handlers.TestRejseSoegningEventHandler,testPerformMedEnkeltRejse
Process finished with exit code 0
任何IDEA的任何人?:) 我觉得我已经在整个网络上搜索了答案。非常感谢您!
我可能应该强调,测试内容根本不重要。我尝试在不同的模块和项目中以这种方式运行许多不同的测试用例。