Bryan Pendleton <[EMAIL PROTECTED]> writes:
>>> Did a number of tests recently get removed from derbyall?
>>
>> Most of the JUnit tests have been removed from derbyall. See
>> DERBY-1952. To run the JUnit tests, you now need to invoke a JUnit
>> test runner directly, for instance:
>>
>> java junit.textui.TestRunner \
>> org.apache.derbyTesting.functionTests.suites.All
>>
> Thanks Knut Anders, that makes perfect sense.
>
> I tried running those tests, and indeed they seem to work in my environment.
> At least, my system whirs and hums for a while and ........ gets printed
> and then OK.
>
> I guess I was feeling a little insecure because I didn't get the
> "traditional" results like derbyall_pass.txt, etc.
>
> In this new JUnit world, with tests that cleverly enable and disable
> themselves based on environment, configuration, etc., how does a
> developer inspect the JUnit run to verify that the desired set of
> tests actually did get run?
That's a good question! I had the same problem earlier today when I
discovered that BlobClob4BlobTest used more time alone than the entire
All suite. The first thing I tried in order to verify that
BlobClob4BlobTest actually was running as part of All, was to start
the Swing test runner (junit.swingui.TestRunner, and remember the
-noloading option!). There I could browse all the test that would be
run, and it did indeed report that BlobClob4BlobTest was being
run. Since I did not completely trust those results (All still ran
faster than BlobClob4BlobTest), I wrote my own test runner which
printed the name of each test case that had been run and how long each
test case had run. Still the same results: BlobClob4BlobTest was
running under All, only faster. I finally found out why (DERBY-2004),
but it took me quite some time to convince myself that the test was
running.
Writing a JUnit test runner is really easy, by the way. I have
attached the test runner I wrote as an example.
--
Knut Anders
import junit.framework.*;
public class TimeRunner implements TestListener {
private long start;
public void addError(Test test, java.lang.Throwable t) {
System.out.println(test + " failed:");
t.printStackTrace(System.out);
}
public void addFailure(Test test, AssertionFailedError t) {
System.out.println(test + " failed:");
t.printStackTrace(System.out);
}
public void endTest(Test test) {
long time = System.currentTimeMillis() - start;
System.out.println(time + "\t" + test);
}
public void startTest(Test test) {
start = System.currentTimeMillis();
}
public static void main(String[] args) throws Exception {
TestResult res = new TestResult();
res.addListener(new TimeRunner());
Test suite = org.apache.derbyTesting.functionTests.suites.All.suite();
suite.run(res);
}
}