Rollback MethodologiesThe aim of the rollback is to transparently ensure a test will run on a safe environment. This can be seen as a fault tolerance mechanism. There are 3 different approaches to achieve this:
- ensure the initial state: this is called pre-conditionning
- ensure the final state: this is called post-conditionning
- ensure all operation are correctly "reversed": this is called rollback
Automatic initializationDepending on the system under test, some operation can be executed in any situation to ensure the system is clean (i.e. reboot of a platform, PIN initialization).
Driven initializationIf making sense, the system under test can be requested for some information to understand in which state it is. Then some tasks can be run on the system under test to initialize it properly. In some case, the information can be retrieved from another entity than the system under test itself (i.e. a property file being updated during the tests).
RollbackOnce the test is completed, it is possible to do the reverse operation on some of the tasks executed during the test. The order of the execution of the rollback tasks must be decided at rollback time. Rollback is useful only for a restricted number of operation being executed during a test. Indeed, some operations (i.e. doing a getXXX() which is just returning a value) does not requires to be rollbacked. The distinction between "rollback able" and "rollback unable" operation must be done by the test developer because it mainly depends on the system under test.
basic taskIn this case, rollback will not require additional parameters than the "identity" of the task to execute the rollback. Identity can be any identifier if it can uniquely represent the task.
complex taskIn some other case, rollback will require additional parameters to execute properly. There, we will need to "remember" the identity of the operation to rollback but also a set of properties associated to the performed task (i.e. the action is to create a named file at a specific path location on a file system:
pid = runProgam("/bin/prog/prog1.exe").
In this case, the rollback process will need to know about pid (the process identifier) resulting to do:
In a common testing environment, we have generally 2 operating "levels": "test" and "test case". The above methodology may be applied to any of these component: