dimanche 5 février 2017

TestNG - run tests in order impossible scenario?

I've tried many ways with no success and I'm starting to believe this is not achievable in TestNG and I just like to confirm with you.

I have web service I'm testing and I need to run few basic scenarios.



My current test functions (each need to be testable as a single test):

  • dbResetTest
  • clearCacheTest
  • openURLTest
  • loginTest
  • actionXTest
  • actionYTest



I also need to run these scenarios consisting from above tests run IN ORDER:

  1. Test login feature (openURLTest -> dbResetTest -> clearCacheTest -> loginTest)
  2. Test X after login (openURLTest -> dbResetTest -> clearCacheTest -> loginTest -> actionXTest)
  3. Test Y after clearing cache (clearCacheTest -> actionYTest)



The issue is, if I made tests from point 1 & 2 dependant on others I won't be able to run scenario 3 because clearCacheTest does not depend on any other in this particular scenario. I've tried running those test in order through xml and by using dependencies but with no success.

Of course I could make actionYTest to call clearCacheTest directly but then if clearCacheTest fails the report will show that actionYTest was the failing one which is what I try to avoid.

I'm pretty sure now what I need is not achievable in TestNG but maybe I'm wrong...

Aucun commentaire:

Enregistrer un commentaire