How to manage different test environments with Squash TA

There are two ways to manage several environments, when building a Squash TA job with Jenkins:

  1. substitution of isolated properties, in this case, the properties that need changing are directly overwritten in the maven command line in the build configuration. This is the preferred method if there are not many properties.

  2. substitution of target repositories, in this case for each environment you point to a subdirectory where the specific properties files are located. This is the prefered method in cases where many properties differ between environments.

In each case, there will be as many jenkins jobs as environement. this is a good practice because this will allow you to track to test results on each environment independantly.

Let's take the example below, we want to test our project on three different environments:

test

integration,

pre-production

Each environment has it own database, but the test set is the same. Here are the properties of the database connexion for each environment properties:

Table 1 : Database connection properties

    • Substitution of isolated properties:

In this case, we have two possibilities. Either we fill the target .files included with the source with blank properties or we use default values (for instances one of the environment). We will use the second option, below in figure 2 the propertiy file (corresponding to the test environment properties) in the directory src/squashTA/targets (Figure 1) called webcalendar-db.properties (Figure2).

Figure 1: Tree view of the position of the directory "targets"

whitch contains the property file(highlighted)

Figure 2: file webcalendar-db.properties

When running the tests via Jenkins, the default environment will then be the "test" one describe by the property file. To take into account the other two, using the substitution of isolated properties, we have to add some options to the build configuration directly in the maven command line.

First, we have to duplicate the job. After the duplacation, in the build configuration, just add the following option : -D<file name>.<property name>=<property value>.

In our example, we will have for the integration environment :

-Dwebcalendar-db.squashtest.ta.database.url=jdbc:mysql://localhost:3306/webcal_int -Dwebcalendar-db.squashtest.ta.database.username=squash_int

Figure 3: adding an otpion in the build section of the build configuration menu

For the pre-production environment :

-Dwebcalendar-db..squashtest.ta.database.url=jdbc:mysql://localhost:3306/webcal_prod -Dwebcalendar-db.squashtest.ta.database.username=admin -Dwebcalendar-db.squashtest.ta.database.password=admin

After theses modifications, we have three different projects running the same tests source on three different environments.

[Work in progress]