I have two big concerns about UI automation.
If I am creating a data record as part of my test and verifying the creation, should I also delete the data in the same test? If yes what if the creation passes but deletion of data fails due to some reason? If deletion fails then I will end up having lots of test data.
If I have to verify the state of some UI element as a result of some operation, should I reset the precondition in the test itself? The steps are:
- perform some a action
- verify the state of an element .
- undo the action so that next time when the same test runs it is in the correct condition.
My concern is what if resetting the action fails. Should resetting the action also be part of the test? If yes, when the resetting fails it fails the entire test, but my actual test of setting and verifying the state has passed.
How should my tests handle situations where I create or change data and undoing my actions is the failure point?