YAML-based projects, either hybrid with a NeoLoad Controller project file and YAML file(s) or with only YAML file(s), can be executed through different ways via:
Configuring a test with NeoLoad as-code can be carried out with the command line. The -project
argument allows declaring the NeoLoad project (".nlp") to launch. For more information, see -project
in List of arguments.
-project
can be run in command line, then test elements can be declared by specifying the corresponding YAML file(s).
-project
can also be used for each file as an alternative to putting all files after -project
. For example, both examples below can be used:
-project "<path>/myproject.nlp" "<path>/servers.yaml" "<path>/user_paths.yaml"
or
-project "<path>/myproject.nlp" -project "<path>/servers.yaml" -project "<path>/user_paths.yaml"
-project "<path>/servers.yaml" "<path>/user_paths.yaml" "<path>/populations.yaml" "<path>/scenarios.yaml"
-project
can specify a folder that contains the default file "default.yaml" and the potential files referenced by the includes.
NeoLoad needs a project folder where resources like JAR dependencies or CSV files for File variables when loading the project can be found.
The project folder is also used to store temporary files and the test result.
The project folder is:
The "Run a test" section of NeoLoad Web allows launching a YAML-based project.
The interface allows you to upload manually or through a GIT import:
The API allows you to upload:
Specify the YAML file(s) to load. If you do not specify any, then NeoLoad will load "default.yaml" if present.
In this use case, the user will use a YAML file describing the Scenario to use instead of the existing one in a NeoLoad project.
The YAML file to use for the scenario settings to apply is:
scenarios:
- name: MyScenario
populations:
- name: MyPopulation
constant_load:
users: 500
duration: 15m
When having the same name, the scenario included in the YAML file replaces the scenario existing in the NeoLoad project. Also, if the scenario available in the YAML file does not exist in the NeoLoad project, it is then added in the project. In this example, we consider that a "Myscenario" scenario already exists in the NeoLoad project, is then replaced by the scenario of the same name specified in the YAML file.
The same mechanism can be used to override Server host names and Test data:
servers:
- name: myapp
host: myapp-staging.company.com
scheme: https
port: 443
variables:
- file:
name: cities_file
path: staging/data/list_of_cities.csv
is_first_line_column_names: true
change_policy: each_iteration
scope: global
The user can then run the following command line:
NeoLoadCmd.exe -project "<neoload projects path>/MyProject/MyProject.nlp" "<neoload projects path>/myproject-scenarios.yaml" "<neoload projects path>/myproject-environment.yaml"-launch MyScenario
Or create a Zip archive with the content of the <neoload projects path> folder, upload it and run it from NeoLoad Web.
Here is an example of using only YAML files, for two different execution environments:
common/design.yaml
staging/servers.yaml
staging/variables.yaml
staging/slas.yaml
preprod/servers.yaml
preprod/variables.yaml
preprod/slas.yaml
You should add top-level files that include the required files for each environment:
staging.yaml:
includes:
- common/design.yaml
- staging/servers.yaml
- staging/variables.yaml
- staging/slas.yaml
preprod.yaml:
includes:
- common/design.yaml
- preprod/servers.yaml
- preprod/variables.yaml
- preprod/slas.yaml
And a default file for example:
default.yaml:
includes:
- staging.yaml
Then, zip the whole content and: