hwellmann / refit

Automatically exported from code.google.com/p/refit
1 stars 0 forks source link

refit in combination with JMockit does not work #28

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Include an arbitrary fit test in JUnit using the FitSuite and a 
FitConfiguration
2. Include "normal" JUnit in the test suite as well
3. Use JMockit in the test suite (it is in the classpath)
4. Run test suite

What is the expected output? What do you see instead?
The expectation is that the fit test and the "normal" JUnit test run without 
any interferences. Instead the fit test crashes with a class not found 
exception, originating from JMockit:

java.lang.IllegalArgumentException: No class with name "MyFixture.htm" found
    at mockit.internal.util.Utilities.loadClass(Utilities.java:57)
    at mockit.integration.junit4.internal.RunNotifierDecorator.fireTestStarted(RunNotifierDecorator.java:34)
    at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java)
    at com.googlecode.refit.junit.FitRunner.run(FitRunner.java:75)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:24)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at com.googlecode.refit.junit.FitSuite.run(FitSuite.java:151)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

JMockit tries to parse the test class name from 
org.junit.Runner.Description.getDisplayName() - this will not work as the 
display name only includes the *.html file name.

What version of the product are you using? On what operating system?
refit 1.7.1
JMockit 0.999.8
Windows XP
JUnit 4.8.2
JDK 1.6.0_22

Please provide any additional information below.
n/a.

Original issue reported on code.google.com by daniel.m...@gmail.com on 18 Oct 2011 at 8:59

GoogleCodeExporter commented 9 years ago
I'm not sure if this can be solved at all - a Fit test is not a Java class, and 
a FitSuite is not a regular JUnit suite, it just contains the Fit test file 
names as children, so you can watch the progress of the suite when running it 
under Eclipse or Maven surefire.

If you click on the name of a test in the suite in the JUnit view of Eclipse, 
you'd normally see the correspoding test class or method in an editor view, but 
for a Fit suite, you get an error message, since the Fit test name is not a 
Java class or method name.

I don't know what JMockit expects here. I wouldn't mind prefixing the test name 
with the FitSuite class name if this is sufficient to make things work - is 
JMockit able to deal with display names that contain a class name plus some 
extra text?

And how does mockit.integration.junit4.internal.RunNotifierDecorator hook into 
the RunNotifier?

Original comment by hwellman...@gmail.com on 14 Nov 2011 at 6:59