CategoryTesting:On using JavaUnit with Microsoft tools.
There are some problems using JUnit with Microsoft's SDK 2.01 (implements JDK 1.1.4).
When running JUnit2 using Microsoft's jview tool, the following error message is output to the command shell:
BorderLayout: cannot add to layout: unknown constraint: nullThe TestRunner frame appears crippled: much smaller than it should be and missing some key elements. I'll try to include a picture of it - must find out how to do that with Wiki. [Answer: Publish it on another web site, and then put the "http" web address for it here. Wiki, instead of displaying a link to your picture will display the picture itself.]
To fix the problem, change line 217 of junit.ui.TestRunner from:
add(panel);to:
add(panel, BorderLayout.CENTER);
When compiling the JUnit2 framework with the jvc tool, errors are detected in junit.tests.TestTest. For example, the following error message applies to line 41:
error J0269: Ambiguous name: inherited 'void TestCase.assertNull(Object)' and outer scope 'void TestCase.assertNull(Object)'--an explicit 'this' qualifier is requiredTo fix the problem, you must change the line from:
assertNull(null);to:
this.assertNull(null);Similar errors are detected on the following lines (line numbers on left):
The above alterations will give you a clean compile, but that doesn't mean that your problems are ended. Consider this scenario:
1. Compile the JUnit2 framework with jvc. 2. Start the test runner with jview. ie. jview junit.ui.TestRunner 3. Type the name of a test class e.g. junit.samples.money.MoneyTest 4. Press the Run buttonThe following exception is thrown: Exception occurred during event dispatching: java.lang.NoSuchMethodError?: junit/ui/TestRunner: method showInfo(Ljava/lang/Str ing;)V not found
at junit/ui/TestRunner.runSuite at junit/ui/TestRunner$7.actionPerformed at java/awt/Button.processActionEvent at java/awt/Button.processEvent at java/awt/Component.dispatchEventImpl at java/awt/Component.dispatchEvent at com/ms/awt/WUIPeer.handleEvent at com/ms/awt/WButtonPeer.handleEvent at java/awt/Component.postEvent at com/ms/ui/AwtUIHost.postEvent at com/ms/awt/WUIPeer.postEvent at com/ms/ui/UIRoot.postEvent at com/ms/ui/UIComponent.postEvent at com/ms/ui/UIStateContainer.postEvent at com/ms/ui/UIButton.¤ at com/ms/ui/UIButton.mouseClicked at com/ms/ui/UIComponent.handleEvent at com/ms/ui/UIComponent.postEvent at com/ms/ui/UIStateContainer.postEvent at com/ms/ui/UIComponent.postEvent at com/ms/ui/UIStateComponent.postEvent at com/ms/ui/UIRoot.Ä at com/ms/ui/UIRoot.forwardEvent at com/ms/ui/AwtUIHost.postEvent at com/ms/awt/WUIPeer.postEvent at com/ms/ui/AwtUIHost.processEvent at java/awt/Component.dispatchEventImpl at java/awt/Container.dispatchEventImpl at java/awt/Component.dispatchEvent at java/awt/EventDispatchThread?.runThe only solution is to compile the JUnit2 framework with Sun's Java 2 compiler, javac. You still need to have made the above-mentioned change to junit.ui.TestRunner. The actual test classes, like all those in junit.samples, can be compiled with Microsoft's compiler. You will then be able to run junit.ui.TestRunner using jview.