You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/08/02 16:19:38 UTC

Testlet to JUnit conversions

In order to convert all the testlets to JUnit TestCases,
we need to do the following:

1) Change name from xxxTestlet to xxxTestCase (preferred but not necessary)

2) Change class extended from org.apache.testlet.AbstractTestlet to
   junit.framework.TestCase

3) Global replace "assertEquality(" with "assertEquals("

4) Global replace "assert(" with "assertTrue(".  The assert() method works
   but is deprecated in favor of the more semantically correct version.


Optionally:

Place all initialization code in "setUp()" and disposal code in "tearDown()"

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Testlet to JUnit conversions

Posted by Berin Loritsch <bl...@apache.org>.
Berin Loritsch wrote:
> 
> Berin Loritsch wrote:
> >
> > In order to convert all the testlets to JUnit TestCases,
> > we need to do the following:
> >
> > 1) Change name from xxxTestlet to xxxTestCase (preferred but not necessary)
> >
> > 2) Change class extended from org.apache.testlet.AbstractTestlet to
> >    junit.framework.TestCase
> >
> > 3) Global replace "assertEquality(" with "assertEquals("
> >
> > 4) Global replace "assert(" with "assertTrue(".  The assert() method works
> >    but is deprecated in favor of the more semantically correct version.
> 
> 5) Change all uses org.apache.testlet.TestletFailedException to
>    junit.framework.AssertionFailedError

6) Add a constructor with a String parameter:
   MyTestCase(String name) {super(name);}

> >
> > Optionally:
> >
> > Place all initialization code in "setUp()" and disposal code in "tearDown()"

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Testlet to JUnit conversions

Posted by Berin Loritsch <bl...@apache.org>.
Berin Loritsch wrote:
> 
> In order to convert all the testlets to JUnit TestCases,
> we need to do the following:
> 
> 1) Change name from xxxTestlet to xxxTestCase (preferred but not necessary)
> 
> 2) Change class extended from org.apache.testlet.AbstractTestlet to
>    junit.framework.TestCase
> 
> 3) Global replace "assertEquality(" with "assertEquals("
> 
> 4) Global replace "assert(" with "assertTrue(".  The assert() method works
>    but is deprecated in favor of the more semantically correct version.

5) Change all uses org.apache.testlet.TestletFailedException to
   junit.framework.AssertionFailedError

> 
> Optionally:
> 
> Place all initialization code in "setUp()" and disposal code in "tearDown()"
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Re: Testlet to JUnit conversions

Posted by Peter Donald <do...@apache.org>.
On Fri,  3 Aug 2001 00:19, Berin Loritsch wrote:
> In order to convert all the testlets to JUnit TestCases,
> we need to do the following:
>
> 1) Change name from xxxTestlet to xxxTestCase (preferred but not necessary)
>
> 2) Change class extended from org.apache.testlet.AbstractTestlet to
>    junit.framework.TestCase
>
> 3) Global replace "assertEquality(" with "assertEquals("
>
> 4) Global replace "assert(" with "assertTrue(".  The assert() method works
>    but is deprecated in favor of the more semantically correct version.

I think it is more todo with jdk1.4 having assert as a keyword.

> Optionally:
>
> Place all initialization code in "setUp()" and disposal code in
> "tearDown()"

globally replace intialize() with setUp() and destroy() with tearDown() ;)

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org