Skip to main content
Rupam_K
Known Participant
August 4, 2009
Question

Run multiple Test Suite in a order

  • August 4, 2009
  • 1 reply
  • 2163 views

If you want to run many test suite class in an order , you can use the following way which i found it useful for my test cases.

my main master suite looks like this
package com.tt.vl.testcase.svc1.testsuite
{
    [Suite]
    [RunWith("org.flexunit.runners.Suite")]
public class MasterSuite
{
public var t1:TestSuite1;
public var t2:TestSuite2;
public var t3:TestSuite3;
}
}
The changes i made in child suite is that i included the order tag in all my child suite in a orderly way i want it to execute
package com.tt.vl.testcase.svc1.testsuite
{
   import com.tt.vl.testcase.svc1.cases.*;
   [Suite(order=1)]
    [RunWith("org.flexunit.runners.Suite")]
public class TestSuite1
{
public var a:Test1;
}
}
package com.tt.vl.testcase.svc1.testsuite
{
import com.tt.vl.testcase.svc1.cases.*;
[Suite(order=2)]
    [RunWith("org.flexunit.runners.Suite")]
public class TestSuite2
{
public var a:Test2;
}
}
package com.tt.vl.testcase.svc1.testsuite
{
import com.tt.vl.testcase.svc1.cases.*;
[Suite(order=3)]
    [RunWith("org.flexunit.runners.Suite")]
public class TestSuite3
{
public var a:Test3;
}
}
so on and so forth
It seems that this order test suite is working.
But you will notice that if you have more than one variable inside a child test suite, it will take those test class in random order. what i mean to say is this for example
package com.tt.vl.testcase.svc1.testsuite
{
import com.tt.vl.testcase.svc1.cases.*;
[Suite(order=4)]
    [RunWith("org.flexunit.runners.Suite")]
public class TestSuite4
{
public var a:Test4;
public var b:Test5;
public var c:Test6;
}
}
Now in this case when it runs the TestSuite 4, inside the testsuite4 it has three Test classes to be run i,e. Test4, Test5 & Tes6. You cant have a control on this classes , it will take random classes in any Test Suite if it has more than 1. So, The only possible way to run a Test class in an order is to have one single Test class inside a Test Suite. I know by definition Unit Testing is not supposed to be dependent but if you want it to be done this is what i found.
Regards,
Rupam
This topic has been closed for replies.

1 reply

Participating Frequently
August 4, 2009

First, this post is about FlexUnit 4 beta 2, which will be released later today, so this will not work for anyone that has current bits

Second, do not follow the advice in this post, this is not the correct solution. Rupam may be having an issue with the code, that has not been determined yet, but this advice in the previous post is ABSOLUTELY NOT correct and, if it works in this moment, may not work long term.

Mike

Rupam_K
Rupam_KAuthor
Known Participant
August 4, 2009

Guys,

Please follow as what Mike says, cause he is right may be this approach wont work in the future. And we shall wait for the right way to overcome the problem.

Thanks

Rupam