How to integrate test automation framework with a CI/CD pipeline (7/7)

Artur Mishustin
4 min readOct 24, 2020

Our framework already can execute Web and API automated tests, understand Gherkin notation and store test results in an HTML file. The last step, is to automate test execution itself.

We will create an AzureDevops pipeline to execute automated tests manually on schedule.

Create Build

For the demonstration purposes, we will use AzureDevops, which also offer free version.

Open Pipelines section and create new Pipeline:

Choose option Use the classic editor:

I will connect repository from the github, but you can use any option:

Find and add Maven step:

To the build will be added 3 steps.

Maven — this step executes a test and generates test execution report.

We need to set the next parameters:

Goals — maven command to execute. We need to perform cleanup, execute tests and set run parameters. Notation ${env} define variable, to set via Pipeline variables.

Test results files — path to the test results, which will be imported to the build results. We set wildcard for the cucumber.xml generated by Cucumber plugin.

Copy report to the stage folder — copy test execution artifacts to the stage folder defined by standard variable $(system.defaultworkingdirectory)

To the Contents filed wildcard for the HTML report should be added.

Publish artifact: drop — publish files from the $(system.defaultworkingdirectory) folder as build artifacts.

Change Artifact name parameter to change folder, which will contain HTML report. And we have done with the build configuration. Now, it’s time to execute it.

For the build execution, we will use default parameters: Windows agent and master branch:

We need to set env variable, defined previously at the maven step.

Click Variables menu and set env variable:

Back to the previous screen and click run.

Build will start:

After completing the testing process, back to the build page and check Tests tabs:

In a build details we can see logs, beautiful tab results tab and can download generated HTML report.

HTML report is under published artifacts section:

Schedule build

Now we will add a schedule for the build. Open build configuration page and choose Triggers tab:

On this tab you can add time triggers and configure a weekday and time for the build.

With this changes build with the automated tests will be exulted automatically.

This was a brief explanation how to create a simple test automated framework for the Web and API tests. Share your solutions and suggest your ideas in the comments down below.

--

--