aspose file tools*
The moose likes Testing and the fly likes junit problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "junit problem" Watch "junit problem" New topic
Author

junit problem

shailesh jamloki
Ranch Hand

Joined: Oct 28, 2004
Posts: 38
Hi,
I want to write a Junit test class, where setUp method will initialize some services. My test class will test the services performence wise. So I want to write number of methods so that for each method the setUp and tear down run and test services regressively.
In order to acheive this I want to add the test methods to my test class at run Time so that at run time i can give the number of methods at run time and the code will add emplty method to class and to suite as well. and then run the test case.
So that I can acheive my goal.
Any help will be heartly appreciated.
Thanks
Shailesh
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Sorry, I don't understand what you are trying to do. Could you please elaborate?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
shailesh jamloki
Ranch Hand

Joined: Oct 28, 2004
Posts: 38
Hi Thanks for your reply.. . I will try to put this in the steps.

1- In my setUp method of Junit test, I am getting some services.. like sesion service. etc.
2- In tear down method. I am making the service null.
3- Objective is :- suppose we have 3 test methods in the junit tests. Then thee times setUp and tearDown method will run.
I want to test this session service behavior like time out etc. by increasing the number of the methods. & this number I should be able to decide at run time.
How this should be acheived?
Hope this clears the situation.
Thanks
Shailesh
Umashankar Ubarale
Greenhorn

Joined: Sep 17, 2008
Posts: 1
You can use junit.extensions.RepeatedTest class to run certain tests repeatedly. Some thing like this.

public static Test suite( ) {
// run the test suite fifty times
return new RepeatedTest(new TestSuite(Test.class), 50);
}

you can pass 50 at run time.
 
 
subject: junit problem