Test environments

Build Promotion Strategy

Software gets built on development machines and would get deployed to environments. The build promotion strategy could involve multiple environments until it reaches production.

A typical example is - a build could get promoted to production as shown below

DEV(local machine) → CI → QA → UAT → PreProd → Prod

Define environments

As an example, let us assume we have 2 environments

  1. UAT
  2. QA

Let us create folder structure to store environment specific properties and test data

  1. Create a folder called data_sets under src/test/resources. Let us use this folder as the root folder to store details of all environment properties & test data

  2. Create folder structure for these environments. Let us create the below folders under data_sets

    data_sets/QA: Folder to hold environment properties & test data for QA environment

    data_sets/UAT: Folder to hold environment properties & test data for UAT environment

Define configs for environments

Let us define configs for each environment - uat.properties and qa.properties

Let us add properties datasets.dir and datasets.env to the configs

  1. datasets.dir : The root folder holding test data & environment properties
  2. datasets.env : The folder under datasets.dir, holding environment specific properties and test data

Here is the code snippet.

config/uat.properties

    # Web Config
    web.url: https://www.uat.google.com/

    # Folder name under resources having test data
    datasets.dir: data_sets

    # Folder name under datasets.dir having data for specific environment eg: UAT | PREPROD | QA
    datasets.env: UAT

config/qa.properties

    web.url: https://www.qa.google.com/

    # Folder name under resources having test data
    datasets.dir: data_sets

    # Folder name under datasets.dir having data for specific environment eg: UAT | PREPROD | QA
    datasets.env: QA