TestNg : TestMethods order of execution

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

TestNg : TestMethods order of execution

Musaffir Lp
Hello

Till few days back I was using a very old version of testNg in my maven project . The version was 6.3.1 ( feel bad for it now as it was released around 10/22/2011 ..  )
There in above version I observed the below behaviour:

If you have test methods ( with priority set ) in a test class and there are dependencies among some tests :
all non depended test methods used to run first and only then the depended tests runs even if the priority also set for those test methods( of cource if there dependency is a pass )

Ex:
public class MyTest {

   
@Test(priority=1)
   
public void test1()
   
{
       
System.out.println("test1");
   
}
   
@Test(priority=2,dependsOnMethods="test1")
   
public void test2()
   
{
       
System.out.println("test2");
   
}
   
@Test(priority=3)
   
public void test3()
   
{
       
System.out.println("test3");
   
}
   
@Test(priority=4)
   
public void test4()
   
{
       
System.out.println("test4");
   
}
   
@Test(priority=5)
   
public void test5()
   
{
       
System.out.println("test5");
   
}

}



This used to give results as
test1
test3
test4
test5
test2






Now I updated to 6.11 ( which is a good thing I did ) ..
Now with 6.11 , the same above test class will give me result as
test1
test2
test3
test4
test5



if there is no priority set , it will give results as  ..
test1
test3
test4
test5
test2



so setting priority is really playing a role now I beleive....
I would like to know , was there a related changes to the testNg lib happened in any of last few release ? I couldn't find one in the release notes ..
I hope am seeing an expected result now


Thanks & Warm Regards
Musaffir

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNg : TestMethods order of execution

Julien Herr
Hi, 

The behavior changed in 6.10 (https://github.com/cbeust/testng/blob/master/CHANGES.txt#L114).

The new behavior you describe is the expected one and was a bug before.

Without priority, the order is not specified and the only one constraint is "test1 before test2" which is the case in your last output.

Julien

Le mardi 7 novembre 2017 09:26:54 UTC+1, Musaffir lp a écrit :
Hello

Till few days back I was using a very old version of testNg in my maven project . The version was 6.3.1 ( feel bad for it now as it was released around 10/22/2011 ..  )
There in above version I observed the below behaviour:

If you have test methods ( with priority set ) in a test class and there are dependencies among some tests :
all non depended test methods used to run first and only then the depended tests runs even if the priority also set for those test methods( of cource if there dependency is a pass )

Ex:
public class MyTest {

   
@Test(priority=1)
   
public void test1()
   
{
       
System.out.println("test1");
   
}
   
@Test(priority=2,dependsOnMethods="test1")
   
public void test2()
   
{
       
System.out.println("test2");
   
}
   
@Test(priority=3)
   
public void test3()
   
{
       
System.out.println("test3");
   
}
   
@Test(priority=4)
   
public void test4()
   
{
       
System.out.println("test4");
   
}
   
@Test(priority=5)
   
public void test5()
   
{
       
System.out.println("test5");
   
}

}



This used to give results as
test1
test3
test4
test5
test2






Now I updated to 6.11 ( which is a good thing I did ) ..
Now with 6.11 , the same above test class will give me result as
test1
test2
test3
test4
test5



if there is no priority set , it will give results as  ..
test1
test3
test4
test5
test2



so setting priority is really playing a role now I beleive....
I would like to know , was there a related changes to the testNg lib happened in any of last few release ? I couldn't find one in the release notes ..
I hope am seeing an expected result now


Thanks & Warm Regards
Musaffir

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNg : TestMethods order of execution

Musaffir Lp
Thanks Julien for confirming it

Warm Regards
Musaffir

On Wed, Nov 8, 2017 at 5:23 AM, Julien Herr <[hidden email]> wrote:
Hi, 


The new behavior you describe is the expected one and was a bug before.

Without priority, the order is not specified and the only one constraint is "test1 before test2" which is the case in your last output.

Julien

Le mardi 7 novembre 2017 09:26:54 UTC+1, Musaffir lp a écrit :
Hello

Till few days back I was using a very old version of testNg in my maven project . The version was 6.3.1 ( feel bad for it now as it was released around 10/22/2011 ..  )
There in above version I observed the below behaviour:

If you have test methods ( with priority set ) in a test class and there are dependencies among some tests :
all non depended test methods used to run first and only then the depended tests runs even if the priority also set for those test methods( of cource if there dependency is a pass )

Ex:
public class MyTest {

   
@Test(priority=1)
   
public void test1()
   
{
       
System.out.println("test1");
   
}
   
@Test(priority=2,dependsOnMethods="test1")
   
public void test2()
   
{
       
System.out.println("test2");
   
}
   
@Test(priority=3)
   
public void test3()
   
{
       
System.out.println("test3");
   
}
   
@Test(priority=4)
   
public void test4()
   
{
       
System.out.println("test4");
   
}
   
@Test(priority=5)
   
public void test5()
   
{
       
System.out.println("test5");
   
}

}



This used to give results as
test1
test3
test4
test5
test2






Now I updated to 6.11 ( which is a good thing I did ) ..
Now with 6.11 , the same above test class will give me result as
test1
test2
test3
test4
test5



if there is no priority set , it will give results as  ..
test1
test3
test4
test5
test2



so setting priority is really playing a role now I beleive....
I would like to know , was there a related changes to the testNg lib happened in any of last few release ? I couldn't find one in the release notes ..
I hope am seeing an expected result now


Thanks & Warm Regards
Musaffir

--
You received this message because you are subscribed to a topic in the Google Groups "testng-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/testng-users/RtRrvh0tE1A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.