You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Eric MacAdie <EK...@MacAdie.net> on 2004/01/29 07:59:10 UTC
[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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [math] Still trying to get started
Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Hi Eric,
First, I'd like to welcome you, we are open to others getting involved,
read up and familiar with the best practices and approaches we've worked
out for the math project.
http://jakarta.apache.org/commons/math/developers.html
http://jakarta.apache.org/commons/math/tasks.html
Three tools will be very advantageous for you to start working with in
this regard
1.) Maven --> Is used to manage the entire project. JUnit tests get
exec'd when most build goals ate executed within it. %maven test or
%maven -Dtestcase=org.foo.bar.MyTest test:single-test
2.) Eclipse --> I think most of us used it for development. Anyways, you
can run the ant build directly within it. Theres an entire gui
environment for junit testing within eclipse.
3.) Ant --> the build.xml file in the math cvs is used for our nightly
builds, it contains scripting that will actually run all the tests for
you. %ant test
All of these have the ability to run JUnit tests either individually or
all at once, out of the box.
Cheers,
Mark
Eric MacAdie wrote:
> 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: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org