[testng-dev] Strict serial execution of tests needed

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

[testng-dev] Strict serial execution of tests needed

Ajit Kulkarni
Hi TestNG developers,

I wish to execute the tests in strictly serial order as specified in testng.xml file using only one thread. (No multithreading)
All my tests succeed if executed stand-alone but when executed together as part of maven build then I get failure.
I think this is due to usage of multiple threads by TestNG.

I think that TestNG uses multiple threads and probably overlaps the execution of methods marked with "@BeforeMethod" and "@AfterMethod" annotations or may be, executes the tests in parallel threads.

This happens even though parallel attribute for suit is not specified.
I also tried to use parallel  = "tests" and specified all test packages in just one "test" tag so that tests in this tag get executed serially rather than in multiple threads. But it does not work.
Also note that I am using "dependsOn" to ensure serial execution.
However I am not using (avoiding) "dependsOn" for the first test in all test classes.

I found one working configuration as below but sometimes this also fails:

<suite name="server-test" preserve-order="true">

      <test name="BackendManagementApiTest">
          <class name="com.test.BackendManagementApiTest"></class>
      <test name="AuthenticateCommandsTest">
          <class name="com.test.AuthenticateCommandsTest"></class>

Note: Above configuration is just a sample. I actually have many tests. For few tests, it works. Problem is when I have many tests eg 275 tests.

I will appreciate any help/suggestion in this regard.

Thanks & Regards,
Ajit Kulkarni

You received this message because you are subscribed to the Google Groups "testng-dev" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-dev/-/m3ShK6j0mzIJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-dev?hl=en.