java -classpath requiredclasspath org.junit.runner.JUnitCore some.package.HelloWorldTest
résultats dans:javaagent avec Junit est à l'origine ClassNotFoundException dans Class.forName
JUnit version 4.8.1
.
Time: 0.005
OK (1 test)
Mais:
java -javaagent:agent.jar -classpath requiredclasspath org.junit.runner.JUnitCore some.package.HelloWorldTest
résultats dans:
JUnit version 4.8.1
Could not find class: some.package.HelloWorldTest
Time: 0.001
OK (0 tests)
La question fondamentale semble être cela:
Class.forName("some.package.HelloWorldTest") (runMain method, line 89, JunitCore)
lancers francs ClassNotFoundException comme suit:
java.lang.ClassNotFoundException: some/package/HelloWorldTest
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:89)
at org.junit.runner.JUnitCore.runMainAndExit(JUnitCore.java:53)
at org.junit.runner.JUnitCore.main(JUnitCore.java:45)
Je ne sais pas pourquoi il ne peut pas trouver la classe. Notez que l'agent d'instrumentation est chargé avec succès et ne lance aucune exception.
Que fait l'agent? – axtavt
Il instrument de code de surveillance dans certaines classes. – Vilas