Harmeet,
Can you turn this into a HowToTestNNTP.txt and stick it in cvs? I'm sure other people would have the same question.
Charles

Harmeet Bedi wrote:

I thought was how a
junit TestCase works (that it will execute all methods that begin with
the word test).

That is one way but it does not provide much control. Junit can construct a
test suite for you based on method signature or you can create a custom test
suite with your own Test objects in the suite. I have followed the latter,
with the twist that you can specify methods that comprise the test suite,
the number of repetitions (see Junit RepeatedTest) and number of concurrent
threads(see Junit ActiveTestSuite) declaratively via XML file.



Take a look at
http://cvs.apache.org/viewcvs.cgi/jakarta-james/tests/src/conf/sampleconf.xm
l?rev=1.1&content-type=text/vnd.viewcvs-markup

and the program that runs tests.
http://cvs.apache.org/viewcvs.cgi/jakarta-james/tests/src/java/org/apache/ja
mes/testing/Main.java?rev=1.2&content-type=text/vnd.viewcvs-markup

The difference here is create tests from BaseTest. Implement methods and the
compose a test via XML file. The XML file can be used to control how the
test is executed.sampleconf.xml represents a working example and format.

These are advantages
- Configurable tests. No need to hardcode things like what host/port to
connect to or any other parameter
- Control test sequence.
- Compose test suite via XML.
- Control the number of repetitions
- Control the number of parallel threads.

Each of the <testmethod> tags in sampleconf.xml represent a Junit test.

Here is how you invoke the test suite.
java org.apache.james.testing.Main <testconfigfile>


It took me a little while to get my head around and satisfy requirements
that unit tests in a test suite should be
- configurable
- composable
- repeatable
- and could run in parallel.
There could be other more elegant solutions. If you don't find this
structure powerful or useful, you could contribute a different one or write
straight JUnit tests.

Harmeet


Relevant Javadocs
TestSuite - allows cutom sequencing of tests:
http://www.junit.org/junit/javadoc/3.7/index.htm/allclasses-frame.html/junit
/framework/TestSuite.html.
ActiveTestSuite - allows concurrent tests:
http://www.junit.org/junit/javadoc/3.7/index.htm/allclasses-frame.html/junit
/extensions/ActiveTestSuite.html
RepeatedTest - allows test repetitions:
http://www.junit.org/junit/javadoc/3.7/index.htm/allclasses-frame.html/junit
/extensions/RepeatedTest.html

----- Original Message -----
From: "Kenny Smith" <[EMAIL PROTECTED]>
To: "James Developers List" <[EMAIL PROTECTED]>
Sent: Thursday, January 02, 2003 3:40 PM
Subject: Re: Python for testing



Hi Harmeet,

I looked at BaseTest and SMTPTest, but I'm a little confused. I don't
see any methods in them that start with "test" which I thought was how a
junit TestCase works (that it will execute all methods that begin with
the word test). Are you using some cool thing about junit that I don't
know or what am I missing?

Thanks,
Kenny Smith

Harmeet Bedi wrote:


----- Original Message -----
From: "Kenny Smith"


some premade smtp or pop junit
tests.

take a look at some existing James Tests at


http://cvs.apache.org/viewcvs.cgi/jakarta-james/tests/src/java/org/apache/ja

mes/testing/

In particular look at EndToEndTest, POP3Test and SMTPTest.

You may also want to look at tests under


http://cvs.apache.org/viewcvs.cgi/jakarta-james/proposals/imap2/test/org/apa

che/james/



Is anyone working on junit tests that I should collaborate with

Hopefully everybody. Most developers have done some tests.



or shall
I charge boldly forward?

Tests are of course always wellcome.

Harmeet


--
To unsubscribe, e-mail:
For additional commands, e-mail:


--
To unsubscribe, e-mail:

<mailto:[EMAIL PROTECTED]>

For additional commands, e-mail:

<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to