I have an app automation project that is written in Java and makes use of the TestNG framework within Eclipse. I am also using Appium framework, but that shouldn't be relevant. I would like to see what the test execution order is without needing to run the full test set.
TestNG Version: 7.3.0
Eclipse Version: 2020-12 (4.18.0)
The reason for this is because I would like to know how well the test will play with Test(N-1) and Test(N+1). There are "clean up" steps in each test that returns the application to a neutral state. All tests expect the application to be in this neutral state so I can avoid having too many dependencies (although I suppose this becomes a dependency in it of itself but I digress).
The issue is that during a full test set run, my newly added test may fail during it's precondition step before it even reaches the actual test. When I attempt to debug the failure by running the test by itself, it passes with flying colors.
To remedy unforeseen issues, I would like to create a temporary group of Test(N-1), Test(N), and Test(N+1) so I can get a better, more accurate representation of how the test will run in the test set. However, I cannot do this easily because I do not know the execution order.
There are a few tests that have some non-negotiable dependencies due to the application design.
Take for example:
@Test(groups = {"dependency-group"})
public void doSomething() {
//precondition
//step 1
//step 1 expected results
//step 2
...
}
@Test(dependsOnGroups = {"dependency-group"})
public void doSomethingElse() {
//precondition
//step 1
//step 1 expected results
//step 2
...
}
@Test(dependsOnGroups = {"dependency-group"}, dependsOnMethods = {"doSomethingElse"})
public void doNothing() {
//precondition
//step 1
//step 1 expected results
//step 2
...
}
and if I added a fourth test in, it would look like
@Test(dependsOnGroups = {"dependency-group"}, dependsOnMethods = {"doSomethingElse"})
public void doEverything() {
//precondition
//step 1
//step 1 expected results
//step 2
...
}
Is there a way of seeing when this will execute in the test set?
How I've been doing it is using Eclipse's outline view, ordering alphabetically, and then rearranging the tests according to dependency with good ol' pencil and paper.
Again, taking into account the example code, I can find that the test set will execute in this order:
1. doSomething()
2. doSomethingElse()
3. doEverything()
4. doNothing()
But that gets tedious when you have over 5 tests with different dependencies and names (again, non-negotiable). Does Eclipse or TestNG have an efficient way of doing this for me so I can spend more time testing and less time singing the alphabet?
Aucun commentaire:
Enregistrer un commentaire