Skip to content

FAQ: Some technical details

Do I need to have a Jenkins server to run my automated tests from Squash TM via Squash AUTOM?

No.

The specific Jenkins jobs required to run automated tests from Squash TM via Squash TF are no longer a prerequisite for running from Squash TM via Squash AUTOM.

With Squash AUTOM, execution is handled by the Squash Orchestrator, a specific component of Squash AUTOM.

Can I launch my Squash TM automated execution plans from a Jenkins pipeline with Squash AUTOM and Squash DEVOPS?

Yes.

Running a Squash TM execution plan from a Jenkins pipeline is a new feature of Squash DEVOPS compared to Squash TF and requires the implementation of jobs as described in the Squash DEVOPS documentation.

How to extract files from a tar file (a.k.a. untar a tar file)?

Some reports (for example the Allure reports) are stored in a tar file.
There are several ways to extract the files from such a tar file.

Using 7-Zip

Download and install the 7-Zip software.
Launch the 7-Zip program.
In its file browser, navigate to the directory that contains the tar file.
Select the tar file in the file browser.
Click the "Extract" button at the top of the screen to untar the file.

Using WinZip

Download and install the WinZip software.
Launch the WinZip program.
Navigate to the tar file in the file browser in the main window.
Click on the "Unzip" button at the top of the page to untar the file.

Using the tar command

If you are on Linux or MacOS or, on Windows, if you have MinGW/MSYS, Cygwin or WSL2 installed, you can use the tar command: tar xvf <tar file>.

How to display an Allure report?

Install Allure

The Allure documentation describes how to install it.

Display an Allure report

Download the tar file from Squash TM by clicking on its name.
Downloading Allure report Untar the tar file, this will create an allure-report directory.
Open a command window and navigate to the directory containing the allure-report directory.
Execute the command allure open.
Opening Allure report Your browser will be open, displaying the Allure report. Allure report

How to set up a hook?

Hooks define actions launched at the start and/or end of each test run. They may be used, among other things, to transfer test artefacts to Squash TM.

A hook definition has the following structure:

- name: 
  events:
  if:
  before:
  after:

name and events parts are mandatory, as well as one of before or after parts.

There are two possible ways to set up a hook:

  • Define the hook in provider plugin configuration file hooks section. This file is typically situated at /app/conf/provider_name.yaml (for example, /app/conf/junit.yaml):

    apiVersion: opentestfactory.org/v1beta1
    kind: ProviderConfig
    current-context: ...
    contexts:
      ...
    hooks:
        - name: my hook
          events:
          - categoryPrefix: junit
            category: junit
          before:
          - run: echo hello
          after:
          - run: echo goodbye 
    
  • Use a separate definition file and set {provider_name}_PROVIDER_HOOKS environment variable to its path:

    JUNIT_PROVIDER_HOOKS=/app/hooks/junit_hooks.yaml
    

    In this case, the file must contain only hooks section:

    hooks:
        - name: my hook
          events:
          - categoryPrefix: junit
            category: junit
          before:
          - run: echo hello
          after:
          - run: echo goodbye 
    

If {provider_name}_PROVIDER_HOOKS environment variable is set, the hooks defined in provider plugin configuration file are ignored.

How to transfer test artefacts to Squash TM ?

It is possible to transfer test artefacts available at the end of execution, for example screenshots, to Squash TM. These files may be accessed from the Execution report list.

Screenshots in SquashTM

To do this, one has to set up a hook.

Let's take, as an example, an execution of a JUnit/Selenium test suite in Windows environment. It uses a Git repository seleniumtests. A screenshot is taken at the end of each test and saved in the project target/screenShots folder.

To apply the hook to Squash TM piloted test runs, we have first to define events to which it is linked. Squash TM uses JUnit provider plugin execute action:

hooks:
    - name: Attach screenshots to JUnit execution results
      events:
      - categoryPrefix: junit
        category: execute

Next, we have to define actions that will be launched at the end of each test execution:

hooks:
    - name: Attach screenshots to JUnit execution results
    events:
    - categoryPrefix: junit
      category: execute
    after:
    - uses: actions/get-files
      with:
        pattern: '*.png'
        warn-if-not-found: No screenshots found after execution.
      working-directory: seleniumtests/target/screenShots

The hook uses actions/get-files action to retrieve all .png files from seleniumtests/target/screenShots folder and attach them to the test execution results. If there are no .png file in this folder, a warning will be issued and the next test will be executed.

Attention

If screenshots folder is defined inside the Git project, working-directory path must contain the project name.

This hook is good enough for transferring screenshots. However, if we do not want to attach previously executed tests screenshots to each test, we have to cleanup the screenShots folder before each execution:

hooks:
    - name: Attach screenshots to JUnit execution results
    events:
    - categoryPrefix: junit
      category: execute
    before:
    - uses: actions/delete-file
      with:
        path: '*.png'
      working-directory: seleniumtests/target/screenShots
      continue-on-error: true
    after:
    - uses: actions/get-files
      with:
        pattern: '*.png'
        warn-if-not-found: No screenshots found after execution.
      working-directory: seleniumtests/target/screenShots

The hook uses actions/delete-file action to delete all .png files from seleniumtests/target/screenShots directory before running a new test. continue-on-error is added to not interrupt the execution if the folder is not found.

Of course, it is possible to modify this example depending on project and use it for transferring to Squash TM files other than screenshots.

You can also use the if keyword to restrict hook scope. For further details, refer to the OpenTestFactory documentation, namely Hooks and Hooks for provider plugins chapters.