Applies to LoadComplete 4.97, last modified on May 20, 2019

About

Cucumber is a framework that runs behavior-driven development (BDD) tests.

You can run LoadComplete load tests from Cucumber tests. To do this, you need to create a feature file that will specify the LoadComplete project and test for the run, and create program code that will run LoadComplete. So, when Cucumber runs the feature file, it will start LoadComplete, and the latter will execute the specified load test (or tests).

You can create a feature file and code yourself. You write the code in Java or in any other language supported by Cucumber (see https://docs.cucumber.io/installation/).

Those who use Java can take a sample Cucumber project that is shipped along with LoadComplete and adopt this project for their tests. The project contains ready-to-use Java classes with step definitions, and a sample feature file. You simply modify this feature file to specify your load test for the run.

This sample project is available in LoadComplete 4.95 and later. Let’s see how you can use it to run your LoadComplete tests.

About sample files

You can find the sample Cucumber project in the following folder:

<LoadComplete Samples>\OrdersCucumber\

The sample project contains these files:

File Description
pom.xml
 
The Maven project file with the required dependencies.
src / test / resources
    Orders.feature The sample Cucumber test that runs sample LoadComplete load tests.
 
src / test / java / Orders
    LoadCompleteUtils.java The helper class for working with LoadComplete.
    OrdersSteps.java The class that contains step definitions.
    OrdersTests.java The class for running Cucumber tests.

Requirements

The computer where you will run a test based on the LoadComplete Cucumber sample must have the following software installed –

  • Java 8 or later
  • Maven version 2 or 3
  • LoadComplete version 4.95 or later

Configure feature file

To run your tests, edit the feature file of the sample Cucumber project:

  1. Open the feature file in any text or code editor:

    <LoadComplete Samples>\OrdersCucumber\src\test\resources\Orders.feature

    The feature file contains a simple Cucumber test that loads a LoadComplete project, runs a load test, and saves test results to a PDF file. Let’s change it.

  2. Find the Examples table in the file:

    Examples table in a sample Cucumber feature file

    Click the image to enlarge it.

    Each row of the table corresponds to an individual test to run. Simply add a row to the table for your LoadComplete load test, or replace values in an existing one with your data. You can add multiple tests (that is, you can add as many tests as needed). Cucumber will run them one by one. All columns in the table are required:

    Column Description Example

    projectFileName

    The file name of the LoadComplete project. It’s possible to use a path that is relative to your Maven project file (that is, your pom.xml file).

    C:\Test\MyProject.ltp

    ..\Basic Test Project\Basic.ltp

    logFileName

    The path and name of the file to which LoadComplete will save test results. It’s possible to use a path that is relative to the pom.xml file.

    The file extension specifies the desired output format. Possible values include: .pdf, .mht and some others. For the list of all supported values, see the description of the exportlog command-line parameter of LoadComplete.

    C:\Test\Results\MyProject.pdf

    ..\Basic Test Project\order.pdf

    testName

    The name of the test to run.

    Note: The sample runs tests only. To run a batch, change the code that forms the LoadComplete command line in the OrdersSteps class.

    Order

    Log

    Do not remove the column headers from the file!

Run your test

Use Maven to run the test:

  1. Open a command-line window.

  2. Change the current folder to the one, where your pom.xml file is located. For example:

    cd "C:\Users\Public\Documents\LoadComplete 4 Samples\OrdersCucumber"

  3. Run the following command to launch your test:

    mvn test

Test results

When the test finishes, LoadComplete saves the test results to the file that you specified in the logFileName column in the feature file.

See Also

Integration Into QA Process

Highlight search results