My question is more to do with structure/cleanliness. I have a test script in TestNG and am looking to add test cases to expand. I want to know if there is a clean way to repeat test cases. Example :
I can do :
@Test(priority=0, name = login )
//some code
@Test(priority=2, name = submit )
//some code
@Test(priority=3, name = accept )
That is just one test scenario. Now I want to do the same thing for a different flow but the test case is repeating ... example:
@Test(priority=0, name = login )
//some code
@Test(priority=2, name = submit )
//some code
@Test(priority=3, name = rejected )
In both flows, 2 tests are the same where I am repeating login and submit. The only change in flow would be what happens each time after submission, such as Submit, Rejected, Cancelled etc. etc. I only know of one way, and that is to repeat writing the login and submit each time.
The question is, is there better/cleaner more structured way to write this instead of the below where I keep repeating login every time?
@Test(priority=0, name = login )
//some code
@Test(priority=2, name = submit )
//some code
@Test(priority=3, name = accept )
//Some code
@Test(priority=4, name = login )
//some code
@Test(priority=5, name = submit )
//some code
@Test(priority=6, name = rejected )
//some code
.
.
.
@Test(priority=n ...
Aucun commentaire:
Enregistrer un commentaire