I have 5 scenarios and those tags are @UserAddSaveButton, @UserEditSaveButton, @UserAddSaveContinueButton, @UserEditSaveContinueButton, @UserDelete
Now I want to execute all 5 scenario in below sequence @UserAddSaveButton, @UserEditSaveButton, @UserDelete, @UserAddSaveContinueButton, @UserEditSaveContinueButton, @UserDelete
See @UserDelete tag is used twice but when I execute Maven command it's executed only once and at last position is not working.
Nope, you can't achieve this with a single TestRunner file.
Here are my 2 ways:
Solution#1:
<suite>
tags that contains TestRunner test classes in this order - TestRunner1, TestRunner2, TestRunner3 and TestRunner2Now run your tests (as mvn test or from testng.xml), deletion scenario will be executed as mentioned in testng.xml order by TestRunner2 suite#2 and suite#4 as you expected.
Solution#2:
@After("@UserEditSaveButton or @UserEditSaveContinueButton") public void deletionSteps(){ // your deletion steps goes here OR // call your deletion step from here }
However, non-technical users will not know that deletion is performed after the execution of @UserEditSaveButton OR @UserEditSaveContinueButton scenarios.