apetit_yms wrote:
>To do so, I've uploaded a zip file (JUnitPerfTestAll.zip) with the example of
what I'm meaning. You'll best use your time examining the code than keeping on
reading... but I will try to expose the problem again anyway.
>
>
Yes, I understand the problem now.
>. protected static Test makeLoadTest() {
>. int users = 1;
>. int iterations = 1;
>
>. Test factory = new TestFactory(JUnitTestAll.class);
>.// Test factory = new TestFactory(TestClass_1.class);
>.
>. Test loadTest = new LoadTest(factory, users, iterations);
>. return loadTest;
>. }
>
>
The TestFactory class expects the supplied test (e.g.
JUnitTestAll.class) to have testXXX() methods. It then makes sure that
each user of the LoadTest gets their own private copy of the test
fixture when running those methods. It doesn't know how to handle a
test suite that contains multiple tests.
>The target for me is to be able of run all my unitary tests in several threads
and with several iterations... in the same sense I'm able of running all my
unitary tests with a single JUnit test class that imports all the other tests
(JUnitTestAll).
>
>
I think I understand your intent. You can do something like this:
protected static Test makeLoadTest() {
int users = 1;
int iterations = 1;
Test loadTest = new LoadTest(JUnitTestAll.suite(), users, iterations);
return loadTest;
}
Notice, however, that a TestFactory isn't used here so you may end up
with concurrency issues in test fixtures. There's no way to use a
TestFactory on a suite containing multiple tests.
But what puzzles me is why you'd want to run your entire suite of tests
en masse as load tests. Instead, I'd recommend picking certain test
case methods that have quantifiable performance and scalability
requirements, then use JUnitPerf to test those. That's generally a
better use of your time and JUnitPerf was designed to help you in these
situations.
Mike
--
Mike Clark
http://clarkware.com
(720) 851-2014