Rollback

The 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
All of these methods can be used together depending on what you're testing. Basically, a procedure setting the 3 mechanism together would be represented this way:


rollback methodology


Automatic initialization

Depending 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 initialization

If 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).

Rollback

Once 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 task

In 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 task

In 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:

killProgram(pid).


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:


target of rollback techniques