Yes, that's the correct output. The big thing is that you want 0 Failures and 0 Errors (Errors are caused by uncaught exceptions, where failures are deliberate calls to assert() methods)
JUnit is a very good testing framework, and it pays to know it, as it's pretty much the de-facto standard for creating test code in java. -----Original Message----- From: Eric MacAdie [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:59 AM To: Jakarta Commons Developers List Subject: [math] Still trying to get started I emailed a few weeks ago about getting involved with Commons Math. One suggestion was to look at some of the tests. I have never used JUnit, and it's a bit hard to run tests that I don't understand when I am testing something else that I do not understand. Anyway, I looked up some JUnit documentation and wrote a class that runs the tests in org.apache.commons.math.special.BetaTest. I just wanted some confirmation that I am able to run some of these tests properly. I included the output and the code below. Am I correct in assuming that when the output is "Time: 0.001 OK (17 tests) Test failures: 0" that all the tests ran correctly? The pages I found used the JUnit GUI for output. They really don't talk much about the text output at junit.org. EKMacAdie ----------------------------------------------- In method RunBetaTests.runAllMethodsInSuite() Test failures: 0 Using another instance of TestRunner ................. Time: 0.001 OK (17 tests) Test failures: 0 End method runAllMethodsInSuite ----------------------------------------------- In method runAnotherTypeOfTest ................. Time: 0.004 OK (17 tests) Number of failures: 0 End method runAnotherTypeOfTest ----------------------------------------------- In method runBetaTest001 . Time: 0.002 OK (1 test) Test failures: 0 ----------------------------------------------- In method runBetaTest002 ................. Time: 0 OK (17 tests) End method runBetaTest002 ----------------------------------------------- public void runAllMethodsInSuite() { System.out.println( "-----------------------------------------------" ); System.out.println( "In method RunBetaTests.runAllMethodsInSuite()" ); TestSuite suite= new TestSuite(); suite.addTest( new BetaTest( "testRegularizedBetaNanPositivePositive" ) ); suite.addTest( new BetaTest( "testRegularizedBetaPositiveNanPositive" ) ); suite.addTest( new BetaTest( "testRegularizedBetaPositivePositiveNan" ) ); suite.addTest( new BetaTest( "testRegularizedBetaNegativePositivePositive" ) ); suite.addTest( new BetaTest( "testRegularizedBetaPositiveNegativePositive" ) ); suite.addTest( new BetaTest( "testRegularizedBetaPositivePositiveNegative" ) ); suite.addTest( new BetaTest( "testRegularizedBetaZeroPositivePositive" ) ); suite.addTest( new BetaTest( "testRegularizedBetaPositiveZeroPositive" ) ); suite.addTest( new BetaTest( "testRegularizedBetaPositivePositiveZero" ) ); suite.addTest( new BetaTest( "testRegularizedBetaPositivePositivePositive" ) ); suite.addTest( new BetaTest( "testLogBetaNanPositive" ) ); suite.addTest( new BetaTest( "testLogBetaPositiveNan" ) ); suite.addTest( new BetaTest( "testLogBetaNegativePositive" ) ); suite.addTest( new BetaTest( "testLogBetaPositiveNegative" ) ); suite.addTest( new BetaTest( "testLogBetaZeroPositive" ) ); suite.addTest( new BetaTest( "testLogBetaPositiveZero" ) ); suite.addTest( new BetaTest( "testLogBetaPositivePositive" ) ); TestResult result = new TestResult(); suite.run( result ); System.out.println( "Test failures: " + result.failureCount() ); System.out.println( "Using another instance of TestRunner" ); junit.textui.TestRunner runner = new junit.textui.TestRunner(); TestResult result002 = runner.doRun( suite, false ); System.out.println( "Test failures: " + result002.failureCount() ); System.out.println( "End method runAllMethodsInSuite" ); } // end method runAllMethodsInSuite public void runAnotherTypeOfTest() { System.out.println( "-----------------------------------------------" ); System.out.println( "In method runAnotherTypeOfTest" ); TestSuite suite= new TestSuite( BetaTest.class ); // TestResult result001 = new TestResult(); // suite.run( result001 ); junit.textui.TestRunner runner002 = new junit.textui.TestRunner(); TestResult result001 = runner002.doRun( suite, false ); System.out.println( "Number of failures: " + result001.failureCount() ); System.out.println( "End method runAnotherTypeOfTest" ); } // end method runAnotherTypeOfTest public void runBetaTest001() { System.out.println( "-----------------------------------------------" ); System.out.println( "In method runBetaTest001" ); BetaTest bTest = new BetaTest( "testLogBetaPositiveNegative" ); junit.framework.TestResult bTestResult = junit.textui.TestRunner.run( bTest ); System.out.println( "Test failures: " + bTestResult.failureCount() ); } // end method runBetaTest001 public void runBetaTest002() { System.out.println( "-----------------------------------------------" ); System.out.println( "In method runBetaTest002" ); // BetaTest bTest = new BetaTest( "BetaTest002" ); // this works - I think - but I don't know what it does junit.textui.TestRunner.run( BetaTest.class ); System.out.println( "End method runBetaTest002" ); } // end method runBetaTest002 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]