2

I am executing the api test cases using TestNG. When i use the below command

clean test -i --tests 'com.testcases.api.*' -Pgroups=mygroup -Pthread=1 -Ptype=api

All test cases get pass however if I increase the thread count to 2 or more than that , my test cases start failing on Jenkins

1

Parallel test are dangerous when you don't think of state of system while executing test .

You are testing the same system in parallel,so one test can affect other test

For example , you have one suite that test delete user feature and suite that test create user feature.

In delete user , you deletes all users and validates the user list to be empty.

This works fine when no parallel tests are there , but when you run these suites in parallel , the tests may start to fail because by the time you try to check that user list is empty , the user creation test running in parallel might have created some users and your delete all users test fails

So run parallel tests only for test that are completely independent and are not affected by state of the system under test

2
  • I do understand you point, hwoever there must be some solution, thats what i am looking here – user3652040 Dec 23 '20 at 5:58
  • There is no way , you should use different system for testing like , or use parallel testing only for mutually exclusive tests – PDHide Dec 23 '20 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.