Hyades: problem with asynchronous HyadesTestSuites [message #3664] |
Wed, 26 January 2005 18:03 |
Silvestr Peknik![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=silvestr.peknik%40tietoenator.com) Messages: 1 Registered: July 2009 |
Junior Member |
|
|
I am using Eclipse 3.0.1 and Hyades 3.2.0.
I created JUnit Test Suite Definition (+ deployment, artifact & location)
with one test method in a loop (20x), both loop and method set as
asynchronous (see the code below). The code was generated automatically. I
just added Thread.sleep(2000) and some output to the test1 method to see
what's happening.
The result is quite confusing for me. In the loop, Loop1 is started 20
times. Each this Loop1 starts one test1. The report (.execution) shows 20
test1 invocation branches, but most of them are empty and marked as
"unconclusive", whereas others contain some random (seems to me) execution
descriptions (start, message, pass, stop).
Why do i have the empty invocations in the result? Why some invocations
contain 5x start and nothing else? Why are there only 7 messages (example,
it varies every run), though there are 20 methods which produce those
messages ? It seems to me that the "main" test class (Threads in my
example) starts all the threads, but does not wait for them to finish. I
briefly checked HyadesTestCase source code, and it seems to me that parent
thread should wait for all its threads, but i am inexperienced programmer
and this is my first cup of Hyades ...
Can anyone tell me what is wrong?
p.s. I tried to change the test1 method to synchronous, and it worked fine
(20 threads, 20 invocations, 20 messages - and in expected order :).
public class Threads extends HyadesTestCase {
public Threads(String name) {
super(name);
}
public static Test suite() {
HyadesTestSuite threads = new HyadesTestSuite("threads");
threads.setArbiter(DefaultTestArbiter.INSTANCE).setId(
"FEEAD2D75A77C7639AF10FF06FBA11D9");
HyadesTestSuite loop1 = new HyadesTestSuite("Loop 1");
threads.addTest(new RepeatedTest(loop1, 20));
loop1.setId("FEEAD2D75A77C763C66358A06FBA11D9").setSynchronous(false);
loop1.addTest(new Threads("test1").setId(
"FEEAD2D75A77C763C3C555306FBA11D9").setTestInvocationId(
"FEEAD2D75A77C763C8FEEB106FBA11D9").setSynchronous(false));
return threads;
}
public void test1() throws Exception {
Thread.sleep(2000);
System.out.println(Thread.currentThread());
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.02925 seconds