Automate Gherkin tests

With your ALM Octane Gherkin tests, add them to an automation project and run them in your CI server builds.

Note: ALM Octane supports Cucumber-jvm 1.2.x only.

Gherkin automation process

When automating Gherkin tests, you use several components:

Component Purpose
ALM Octane Create and save the test, test scripts, and analyze the results
Your IDE Add automation for the test, through a .feature file included in a JUnit Runner automation project.
Jenkins CI system Runs the test as a part of a build/pipeline run

The entire process follows this flow:

Back to top


Back to top

Create and download the Gherkin test

To work with a Gherkin test in your IDE, you must create the test.

To create and download the test:

  1. In ALM Octane, if necessary create and add scenarios to your Gherkin test. For details, see Create Gherkin tests.

  2. In the Scripts tab of the test, click the Download script button .

    The script is downloaded as a .feature file.

  3. Add the .feature file to your automation project.

Back to top

Add the OctaneCucumber runner class to your automation project

To generate a Cucumber-based test results file that the CI server sends to ALM Octane, add the octane-cucumber-jvm library to your automation project and use the OctaneCucumber class as the test runner for your test classes.

The octane-cucumber-jvm library is supported for use on Java environments only.

To add the Cucumber classes:

  1. In your project, add this dependency in your POM file:


    Enter a <version> tag based on the version of ALM Octane you are using:

    ALM Octane version <version> tag
    ALM Octane versions 12.53.8 until 12.53.15 12.53.8
    ALM Octane versions 12.53.16 until 12.53.18 12.53.16
    ALM Octane version 12.53.19 until 12.53.21 12.53.19
    ALM Octane version 12.53.22 until 12.55.6 12.53.22
    ALM Octane versions 12.55.7 and higher 12.55.7
  2. In your JUnit Runner .java file, import the Octane Cucumber runner class:

    import com.hpe.alm.octane.OctaneCucumber;
  3. In the JUnit Runner .java file, change the cucumber.class to OctaneCucumber.class:

    Package feature.manualRunner;
    import com.hpe.alm.octane.OctaneCucumber;
    import cucumber.api.CucumberOptions;
    import org.junit.runner.RunWith;
    public class ManualRunnerTest{

Back to top

Create a build job in Jenkins

In your Jenkins build job configuration, add a build step that runs the test.

In the post-build actions section, add an HPE Octane Cucumber test reporter step.

Note: If you add an HPE Octane Cucumber test reporter step, the CI server sends only the Gherkin test results to Octane. Test results from other automated tests are not sent as part of the build.

The post-build action instructs Jenkins to copy the test results XML files from the path specified in the post-build actions to the Jenkins job build folder. From this build folder, the results are copied to ALM Octane.

During the test run in the CI server, the OctaneCucumber runner generates a run results report called <test name>_OctaneGherkinResults.xml in a dedicated folder called gherkin_results.

Note: If you are using the octane-cucumber-jvm library version 12.53.19 and earlier, the file name of the results is called OctaneGherkinResults.xml.

If the post-build Cucumber test report step fails, the CI server fails the entire build.

Back to top

Add the build job to a pipeline

Ensure that your build project or build job that runs the test is included in an ALM Octane pipeline. When you run the pipeline, Jenkins generates the test results. The Application Automation Tools plugin reads the results file and sends the details to ALM Octane.

For details on creating and working with pipelines, see Create and configure pipelines.

Back to top

Run the pipeline

To send the results to ALM Octane, you must run the corresponding pipeline.

To run the pipeline:

  1. In ALM Octane or in the CI server, run the pipeline.

    ALM Octane links the test results to the original Gherkin tests. ALM Octane uses the Test ID tags found at the top of the .feature file and the test script in ALM Octane ALM Octane assigns the test using these criteria:

    • If the test already exists in ALM Octane and the Test ID tag is included in the .feature file, ALM Octane does the mapping by the Test ID tag.

    • If the Test ID tag is not included in the .feature file, ALM Octane does the mapping by the .feature script path.

    • If the test does not exist in ALM Octane, the system creates a new test in ALM Octane and maps the results to it.

  2. Analyze the results in ALM Octane

Back to top

Next steps: