If you need to run tests from 2 classes from testng.xml, why does TestNG accidentally select mehods from classes?

I need to run tests from 2 classes with TestNG. The testng.xml configuration indicates this:

<classes> <class name="com.xyz.TestA"></class> <class name="com.xyz.TestB"></class> </classes> 
  • TestA has methods: i1, i2, i3, i4
  • TestB has methods: j1, j2, j3, j4

Testing is performed in the following sequence:

i1, i3, j1, j4, i2, i4, j2, j3

Does anyone know the reason? Pls kindly help ~ Thanks so much!

+1
source share
1 answer

If you are using the latest TestNG, use the "preserve-order":

 <test name="foo" preserve-order="true"> <classes> <class...> 
+1
source

Source: https://habr.com/ru/post/900457/


All Articles