Project: JDT
Bug 151773 [JUnit] Comparison dialog doesn't open for JUnit4 tests
Reported: 2006-07-25 17:33:59 | Status: verified fixed

Double clicking the first line of the failure trace when it is a comparison failure (i.e., assertEquals( "1", "2" );) opens up the CompareResultDialog when using the JUnit 3 test runner. When using the JUnit 4 test runner (with either a JUnit3 or JUnit4 test case) double clicking does nothing. Digging a bit, it seems that the TestElement.fExpected and TestElement.fActual elements are set to null, which disables the FailureTrace.fCompareAction and thus results in no CompareResultDialog being shown. These fields seem to be set from the RemoteTestRunnerClient's fExpectedResult and fActualResult fields. In the JUnit3 case, these fields get set appropriately by calls to RemoteTestRunnerClient.AppendingProcessingState.readMessage, but under the JUnit4 test runner these methods do not get called. I did not bother looking any further at this point. Sample code: import junit.framework.TestCase; public class Tester extends TestCase { public void testComparison( ) { assertEquals( "Gah", "Gooh" ); } } Create a JUnit run configuration and then try both the JUnit3 and a JUnit4 test runners to see the differences in behaviour.

Files changed in fix:
org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/FailureException.java org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestListener.java