Help about parallel=classes!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help about parallel=classes!

casey
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hi, I am a beginner. I have tried parallel=classes, but it seems not working like what I thought. I have two @Test in one class, but the two @Test run in different thread.

My class:cctest.ATest
@Test
public void a(){
System.out.println(Thread.currentThread().getId() + ":a()");
}
@Test(dependsOnMethods = { "a" })
public void b(){
System.out.println(Thread.currentThread().getId() + ":b()");
}

xml:
<suite thread-count="3" name="st_template" parallel="classes" >
  <test name="mytest" preserve-order="true" enabled="true">
    <classes>
      <class name="cctest.ATest" />
    </classes>
  </test> 
</suite>

when I run this, I got this result:
10:a()
12:b()

why the two @Test not run in the same thread? Did I miss anything? Anyone can help?
Thanks in advance~

It seems it is caused by dependsOnMethods, if remove this annotation from b(), they will be run in a single thread. Why this happens? dependsOnMethods is a must, does there have any workaround?