I think that they way things work in the previous post should remain and would 
be a natural extension of the base JUnit TestCase.   

However, I think there should be some changes to this behavior if running a 
TestCase that is specifically a server TestCase (when talking about having 
client/server tests where there are two process running for a test case, which 
is what I want for the remoting tests).

So, for server test cases...

- Need a way to tell the server to start up and initialize.  This should be 
done using setUp() method.  Once this method returns, it is assumed that the 
server is ready to receive calls.  
- Need a way to tell the server that it can shutdown and clean up.  This should 
be done using the tearDown() method.  This method will only be called in the 
case that all clients are finished making their calls to the server.  

The server may have test methods, which will be called just as in the case of 
regular JUnit test runs.  However, the setUp() and tearDown() will not be 
called prior and after each test method call; it will be called only once each 
per test run.  These test methods can contain asserts and are suggested to be 
used for validation of server data and metrics.  

IMPORTANT - the tearDown() method may be called even while a test method is 
being run.  This is intentional and allows for the test method to loop until 
the tearDown() method is called.  So a possible example of where this could be 
used is:

...
private boolean stop = false;

public void testServerMetrics()
{
        while(!stop)
        {
                // collect data here
        }
}

protected void tearDown()
{
        stop = true; // so will cause testServerMetrics() to break out of loop
        
        // do shutdown and clean up code.
}

Also, another change to the default JUnit test case behavior is that there will 
NOT be a new instance of the server test created when it moves to the next test 
method.  This is due to not knowing where the clients will be in their test 
run, so can't tear down a server test case instance and build up a new one just 
to run a new test method.  

All this is just design talk at this point and I have to actually write the 
code to make it work this way (if possible).  Wanted to post this so can field 
any objections before I go through the effort.

-Tom

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874159#3874159

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874159


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to