Automation testing is a difficult exercise with a tendency to become error-prone and time-consuming in a short period. Follow these 6 powerful strategies for automation testing to get the best results.
1. Introduce Automation for Corner Cases
While performing automation testing, in case of multiple values in a test (for instance 1 to 10), a tester tends to choose the number randomly from the range or test several values instead of 1, since testing all values would be very expensive.
However, in such cases, you should always test the values 1 and 10. It is with these corner values there are often associated different errors, which programmers do not take into account during the development or writing of unit tests. Thus, one should check at least 3 numbers: 1, 10, and any number in the range from 2 to 9 inclusive in an automated test.
2. Differentiate between Error and Warning
Generally, all errors can be classified into two types: (i) critical and (ii) non-critical. From an automation point of view, this would mean that if after we can continue to run the test after an error occurs, then the error is not critical. Such non-critical errors are called ‘warnings’.
In order to establish a distinction between critical and non-critical errors, they must be marked with a colour different from the colour of the critical errors. Unfortunately, automation software tools are programmed in such a manner that when the unit test engine is used for GUI testing, the test stops at any error that appears. In order to solve this problem, in case of an error, we simply add an error line to the error list (which is initially empty), in tools using JUnit reports. After the test concludes, check this list. If the list is still empty, then there are no errors in the test. However. In case any such error is found in the error list, the entire test is marked as a failed one and all the accumulated errors are put to the log.
3. Use the Appropriate Methodologies
Automation testing uses a lot of specific methodologies, including DDT, ODT, BDD, KDT, Page Objects, Model-Based Testing, etc. However, it is not enough to just know them; you should also learn to use them appropriately.
For instance, Keyword-Driven (KDT) methodology is required in those projects where a single person writes the script code and the tests are written by multiple people. If only a single person is fully engaged in the automation process in the project, the support for the KDT approach will take two-thirds of the time, and only one-third will be utilized on creating the test.
The disadvantage of the approach taken above is obvious: tests too often have to be changed, and a lot of time has to be spent on it. Sometimes it is easier to just rewrite them again if the existing functionality has been greatly changed. However, the efficiency of such automation is very close to zero. Therefore, every time starting a new project, try to think about what you will need, and what you can refuse.
4. Verification of Individual Bugs
In most cases, tests are written to verify some functionality in general and do not verify special cases, for instance, a bug with specific data. However, sometimes it happens that once corrected bug appears again after some time; the reasons for its appearance can be completely different, but the result looks the same. In such cases, it makes sense to write a separate test to verify this particular bug or a separate test to verify several bugs.
5. Make a Pilot project before writing real tests
Normally, pilot projects are those projects that last one or two months and are not needed for any other purpose except information. Such pilot projects are used in several cases-
- if you are using a new automation tool for the first time,
- if you automate a new type of project (for instance, you had always worked with web applications, and now move on to testing the desktop or mobile applications),
- when implementing automation in a project where it did not exist before, and it is necessary to quickly show a certain result to the management or the customer.
The objectives for which a pilot project is used include (i) trying the tool, (ii) understanding its capabilities and (iii) studying its main advantages and disadvantages. Pilot projects are also valuable for training new team members who have not worked in the field of test automation before.
6. Simplify everything you can
An automation tester works with a lot of things- code, tests, virtual machines, test environment, test data, SQL queries, reports and more. It is extremely important that everything that you work with is simplified to as great an extent as possible. If you have a difficult test and you have to think through for a long time what exactly it does – break it down into several simple tests.