vendredi 28 août 2020

How to make a test run last in a TestNG tests suite

I am using TestNG for functional testing in my project and I need to ensure a specific test run the last.

I tried using dependencies and establishing a "lineal" flow of execution through those dependencies, but this solution was a little bit inefficient since there are tests that actually can run without having to ensure another test pass before they are being executed.

So, the main problem with dependencies is if a test fails in the execution, TestNG doesn't execute the rest of them and I don't want this behavior.

Also, the order I need for my test suite is not lineal, for example: Test 1 -> Test 2 -> ... -> Test n

Actually, my ordering is more like a tree:

  • Test 1
  • Test 2 -> depends on 1
  • Test 3 -> depends on 1
  • Test 4 -> depends on 3
  • Test 5 -> depends on 4
  • Test 6 -> depends on 1 and 3
  • Test 7 -> depends on 2 and 6
  • Test -> depends on 3 (this one should be executed as the last)

(Above example is hypothetical and only tries to describe my test scenario)

I tried using priorities but they seem not to work like this. Do you have a recommendation about this guys? Thank you for your help and sorry for the noob question.

Aucun commentaire:

Enregistrer un commentaire