Search the web
Sign In
New User? Sign Up
junitperf
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Threaded test doesn't end   Message List  
Reply | Forward Message #32 of 94 |
Re: [junitperf] Threaded test doesn't end

Hi Frank,

>
> The graphical UI tells me, that we had 7 runs, sometimes 6, sometimes 0.
> The textui states that 2 Tests are ok. I want to see 10, because there
> are 5 tests for each user.
>

Interesting. When I run it through the graphical runner, it
consistently returns 10. Can you tell me more about how you're running
it through the graphical runner?

As for the text ui, it also consistently runs 10 tests if I run it as:

java junit.textui.TestRunner Example

If you run it via a main() method, remember to specify that you want it
to run the suite() method. So, this will run 10 tests:

public static void main(String[] args) {
junit.textui.TestRunner.run(Test.suite());
}

But this will run 2 tests:

public static void main(String[] args) {
junit.textui.TestRunner.run(Test.class);
}

To summarize, if you run a test via the command-line using the form

java junit.<text|swing>ui.TestRunner Example

then JUnit will first try to run the suite() method. If a suite()
methods doesn't exist, then JUnit creates a suite by finding all
testXXX() methods.

If you run a test via its main() method using something like

java Example

then you must qualify in the main() method whether it should run the
suite() method or create a suite automatically using reflectiong (e.g.
Test.class). I suspect this is the source of the problem you are observing.

As an aside, there's no need to directly use a ThreadedTest when using
the LoadTest. The LoadTest will use a ThreadedTest under the hood to
ensure that each user runs within their own thread. So the following
will work equally well:

public static Test suite() {
int maxUsers = 5;
return new LoadTest(new TestSuite(Example.class), maxUsers);
}

Let me know if that helps.

Regards,

Mike

--
Mike Clark
http://clarkware.com
(303) 589-3812




Thu Jun 26, 2003 7:41 pm

clarkware
Offline Offline
Send Email Send Email

Forward
Message #32 of 94 |
Expand Messages Author Sort by Date

Hi, Im just playing with threaded tests. I try to simulate 5 users each running in a special thread. But I don't see the result I think I should see :-) The...
Rogler, Frank
rogler_frank
Offline Send Email
Jun 26, 2003
6:13 pm

Hi Frank, ... Interesting. When I run it through the graphical runner, it consistently returns 10. Can you tell me more about how you're running it through...
Mike Clark
clarkware
Offline Send Email
Jun 26, 2003
7:42 pm

... sometimes 0. ... there ... observing. ... Hi Mike, I left out the threadedTest and it runs ok. Meanwhile, I've got another problem: I try to test a web...
rogler_frank
Offline Send Email
Jul 9, 2003
1:38 pm

... Is the user configured in setUp()? If so, you'll want to use the TestMethodFactory to ensure that each thread spawned by the LoadTest gets its own...
Mike Clark
clarkware
Offline Send Email
Jul 9, 2003
4:17 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help