Ecosystem


Introduction

Let’s introduce the ecosystem notion in SKF. An ecosystem is a suite of test cases which have in common a setup phase and a teardown phase.

It allows to prepare the environment for a specific bunch of test cases and doing so for as many ecosystems as you need.

Each tests directory of an SKF project and its subdirectories correspond to an ecosystem as soon as they contain test cases.

The name of the ecosystem (Such as it will appear in the execution reports) is determined by the name of the directory which contains it.

The ecosystem directory contains :

  • A setup.ta file (optional) : To prepare the environement for the bunch of test cases included in the ecosystem.
  • From 1 to N test files (<test_name>.ta) : Each file corresponding to one test case.
  • A teardown.ta file (optional) : To clean-up the environement after the execution of all test cases included in the ecosystem.

An ecosystem execution takes place in 3 ordered steps (Independant of the order in the directory) :

  1. A setup phase where the SKF script setup.ta is executed (if present). This phase is executed only once.
  2. A test cases execution phase during which each test case is executed one after the other.
  3. A teardown phase where the SKF script teardown.ta is executed (if present). This phase is executed only once.

Here is an example with 5 different ecosystems in a Squash TF automated project :

../_images/squash-ta-ecosystem.jpg


Workflow

First there is an initialization of contents of the following directories : targets, repositories and shortcuts. At this step the different elements of those directories are verified. If everything is ok these elements are available for the full duration of the execution, therefore for all different ecosystems to execute.

Afterwards comes the execution of the different ecosystems. Each of them with its own ecosystem context and for each test case its own test context.

Whatever status an ecosystem has after its execution, the next ecosystem of the test suite is launched.

Once all ecosystems have been executed a cleaning-up step occurs, and finally the publication of the execution report available in the ‘target’ directory.

Here is a schema of the SKF workflow :

../_images/workflow-squashtf.jpg


Ecosystems Setup & Teardown scripts

As said before, an ecosystem is a suite of test cases which have in common a setup phase and a teardown phase. An ecosystem may - but is not required to - define up to one setup script and one teardown script. They obey to the same rules than regular test scripts, except two points :

  • They don’t care about phases : A setup or teardown script only contains instructions, no phase should be defined.
  • Regular resource names have a special context : the ecosystem context, which is common to BOTH setup and teardown ecosystem script and which is INDEPENDANT (in term of resources) of the test cases included in the ecosystem.

Note that unlike other tests (that may be named freely), setup and teardown scripts MUST be named respectively ‘setup.ta’ and ‘teardown.ta’.

Example : valid setup/teardown script

* - //that's right, no phase needs to be defined
    //instructions are directly written as follow :

    instruction
    instruction
    instruction

An example of project containing ecosystems setup and teardown scripts :

../_images/project-ecosystems-teardown.jpg