Broadly the test automation can be applied to the three stages like: unit, integration, and system wide.
Each of these stages has peculiar characteristics and is implemented in a different way.
1) Automated Unit Testing:
Unit tests consist of testing components individually. The software testing engineer verifies the input domain only for the unit in question, ignoring the rest of the system. These tests require code construction executed during depuration mode.
The software developer has the responsibility to ascertain that units are correctly constructed, analyzing code, comparing it with the system's specification and checking if any functionality is missing or was not completely developed.
Tests and error corrections may be made at any stage of the software development cycle. Nevertheless, some experts declare that the cost of searching and finding errors increases while the development advances. It is cheaper to fix defects during the codification stage.
Procedure to implement unit testing:
1) Prepare test environment.
2) Define input domain based on requirements and use cases.
3) Define, for every input, expected output based on requirements and use cases.
4) Implement components to be tested.
5) Group unit tests in collections of components.
6) Implement unit tests.
7) Execute unit testing.
8) Fix component tested, if there is an error.
9) Execute step 8 while any error remains.
Unit testing consists basically of:
1) Variables initiation, including database population.
2) Business rules or input functions are applied.
3) Destruction of variables, including the cleaning up of data input to the database.
4) Comparison between results of applied function with expected results, failing in case they differ.
Grouping unit tests forms a tree, where the leaves consist of the unit tests and in the other nodes are the groupings of unit tests. This technique allows automating and executing all tests, a subset of them, or each one individually.
Unit test automation enables dynamic problem detection, generating automated reports, and facilitates execution of regression tests, which are necessary for every meaningful code update.
2) Automated Integrated Testing:
Integrated tests are performed to test various parts of the system (components, modules, applications, etc.) that were separately developed in a set. Integration tests are executed after each of the system's parts has been tested individually, using unit tests or systemic tests, in case of applications that communicate (with each other).
Analyzing the time line, software testing engineer can notice that integrated tests are mainly performed after a unit test and before systemic tests, normally are executed by developers that create their own builds and test integrates units or by a specialized software testing team.
Procedure to implement integrated tests:
1) Prepare test environment, using test data and test server, which are configured to simulate the production environment.
2) Identify test cases based on requirements and architecture.
3) Detail procedures for each test case.
4) Implement integrated tests.
5) Execute integrated tests.
6) Analyze results. If errors are found, they must be registered in the problem reports tool and associated to people responsible for the corresponding corrections. If none are found codification may stop.
7) Fix problems encountered.
8) Execute tests again. After ending it, return to step 6.
3) Automated System Testing:
System testing is the most misunderstood and most difficult testing process. System testing is not a process of testing the functions of the complete system or program, because this would be redundant with the process of function testing. System testing compares the system or program with its original objectives (requirements).
In this stage a test environment, compatible with the one in which the system or program will be used, is necessary.
Various test types are performed during this stage: usability, functionality, performance, stress, and so on. Some of these may be automated to make execution more agile, especially in case of regression tests.
System wide tests can be automated in many ways, but a list follows with their basic activities:
1) Prepare test environment, installing and configuring necessary hardware and software.
2) Design test cases.
3) Define automation strategy.
4) Select project scope for automation.
5) Implement systemic test scripts for each test case.
6) Execute systemic test.
7) Analyze results. If errors are found, they must be registered in the problems report tool and associated to people responsible for the corresponding corrections.
8) Fix problems found.
9) Generate reports with tests status.
10) Execute tests again, returning to step 6 after finishing them.