Keys to writing better test cases when opting for Automation Testing
Before turning to test automation from manual automation, the question that arises to a tester is that what should they learn first? The general mindset is that they should start with coding but the bitter truth is that being able to code is an innate trait – some can and some can’t code. Although the fact is that a good tester is much better than a poor automator! On the other hand, many testers who have turned to test automation never actually thought to design ‘good’ test automation.
So in this blog will be highlighting the major differences between the manual testing and automation testing on particularly how the tests should be written and executed:
- Tests can depend on each other if tester wants it, for example one test can create the data required for the next tests.
- Tests can often fail but the tester can describe the results accordingly. The tester can proceed on testing the next case even when the previous test leaves the system in invalid state.
- Different test cases can take different time to process different actions but tester knows when to wait and when to continue with the testing.
- Tests are needed to be performed on specific and regular time intervals, dates for which can be set and reset by the tester as needed.
- Tests cases should be written as independent test cases so they don’t need to be run together every time. This enables the tester to use the same test suites every time and for everything by just changing the currently changed features and testing them.
- Test cases should be cleaned up once they fail so that next test cases can execute properly.
- The automated test case should test only one feature, this makes it convenient for tester to check the results as one particular failure would point to only specific element. With automated tests one can check the results after the test has been completed, so this feature becomes very important as its essential to know that what has been done.
- The automation tests should create a report relevant to the recipient it has to be delivered to. For instance the project managers it is sufficient to show that how many tests were executed and how many failed but if the report is for a developer then he has to know much more detailed information as he needs to find and correct the bugs.
For an automation tester himself, he needs to know where the problem occurred to rectify the automation script. So it is very important to generate a report which is relevant to the receiver.
- An automation test case should use the data wherever it is possible in the testing process.
- The test case should wait until certain action in the System under Test (SUT) is completed, instead of immediately progressing towards the next cases; it helps in maintaining the synchronization of the test. It should not always wait for a fixed time which can some time be too long or too little depending on the situation.
- The automation test cases should always perform date sensitive cases.
- Another very important thing about the automation test cases is that they should be written in such a way that changing the testing tool should not mean that all the test script needs to be written from scratch. The test cases should be flexible for different testing tools.
These are some major differences which should be kept in mind while turning to the manual testing from automation testing. There are many other difference but these are the ones that should not ignored and can help in writing better automation test cases and hence make a tester’s life much more easier.