ATS : Maintaining the test environment

Introduction


Most of the times the automated tests code can be divided in 3 phases: Configuration, Action and Verification.

This page shows how to prepare the environment of the Application Under Test and this falls in the Configuration phase.

By preparing the environment we mean taking care of the file system, database and more.


How important is it?

Almost always it is very important to know the state of the environment.

Dirty environment will probably cause your Application Under Test (AUT) to behave not as expected and of course this will compromise the test results.

Sequencial tests

It is considered as bad practice to expect that your tests will run in some predefined order.

When creating a test, you should not worry about any other tests. The current test must produce same results no matter if run alone or in a sequence with some other tests.

In order to make this possible, you need to maintain same initial environment which is appropriate for running any test.

Environment backup and restore


Environment backup is the process of making an image of the initial environment. So imagine you have installed, configure and started your AUT, now as it is in a good initial state and you need to make an image. For example this might mean to remember some content on the file system and database.

Environment restore is the process of bringing the environment back to its initial state, so the next test can start safely. This means you need to restore some content of the local files system or database, or you need to restart some system process etc.

When is the environment backed up?


Usually right after installing and configuring your AUT.

It is possible to describe your environment in XML format and let ATS make an image of it.

When is the environment restored?


Usually right before calling your next test method.

Environment maintenance using ATS Agent


ATS comes with a library called Environment Cleanup which takes care of environment backups and restores, but usually the preferred way is to use this library silently i.e. without writing Java code but rather just describe the environment in some XML file.

Here are the details.

Environment maintenance using ATS Environment cleanup library


Here we show how to maintain the environment using Java code only.



Back to parent page

Go to Table of Contents