|
|
I have some JUnit test cases for an application. When I pull up the test's context menu, JBuilder doesn't offer the 'run test' or 'debug test' items. Tests I create with the New Test wizard do get these items, so why don't mine? |
| This is a known issue I've already reported. It's working as Borland designed, so I suspect it ended up as a low priority feature request rather than a bug.
JUnit's own test runners use reflection to decide what is a test and what is not, and they look for test*() and suite() method signatures, not the class/interface parentage. So, anything which provides a suite() method is treated as a suite(), regardless of the classes it extends or the interfaces it implements. JBuilderTestRunner demands that a test extend TestCase or Test. (I forget which.) This same logic is used when building the context menus, so only classes which extend the correct parent are viewed as test cases. I think this is bad design. Even JUnit's own test cases fail to meet JBuilderTestRunner's parentage assumptions, and they don't appear as Tests in the context menu, either. So, for my own bastard test cases, I just create a main() class in each one that invokes a JUnit Test Runner. I usually use something like this:
public static void main( String[] argv ) {
junit.textui.TestRunner.main( new String[]{"com.aravox.cocoa.MainTest"} );
}
This is the main class from com.aravox.cocoa.MainTest.java. It lets me just use the context menu's Run command from the context menu to run the tests via the text runner. Output goes into the message pane. | |
| [Append to This Answer] | |
| 2002-Jan-05 10:37am |
| ||||||||
|
Java Community
Java Tools |
Code Central JB OpenTools |
Community Recent Threads |
Borland Chat Chat FAQ |
||||||||||||||
|
Feature Matrices 3.0 | 3.5 | 4.0 5.0 | 6.0 | 7.0 |
Shop for JBuilder |
JBuilder Downloads and reg keys |
Report Piracy | ||||||||||||||
|
Online Manuals 4.0 | 5.0 | 6.0 7.0 |
Borland DevSupport's Bug/RFE Form Quality Central Client |
JB Patches & Updates |
JBuilder FAQs TIs | ||||||||||||||
|
JBuilder Newsgroups |
Tamaracka's News Archive |
Mr. Haki's JBuilder Machine |
JGuru's JBuilder FAQ |
||||||||||||||
|
Sun's Bug Parade |
|||||||||||||||||
|
|||||||||||||||||