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:
The sample project contains these files:
||The Maven project file with the required dependencies.|
|src / test / resources|
|The sample Cucumber test that runs sample LoadComplete load tests.
|src / test / java / Orders|
|The helper class for working with LoadComplete.|
|OrdersSteps.java||The class that contains step definitions.|
|OrdersTests.java||The class for running Cucumber tests.|
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:
Open the feature file in any text or code editor:
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.
Find the Examples table in the file:
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
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).
..\Basic Test Project\Basic.ltp
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.
..\Basic Test Project\order.pdf
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.
Do not remove the column headers from the file!
Run your test
Use Maven to run the test:
Open a command-line window.
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"
Run the following command to launch your test:
When the test finishes, LoadComplete saves the test results to the file that you specified in the logFileName column in the feature file.