Run an as-code test in NeoLoad Web
A local check confirms that a user path works. To see how your application behaves under load, you need an as-code test in NeoLoad Web. This test also shows whether an authenticated session stays active from one iteration to the next.
The NeoLoad command-line interface (CLI) uploads the same project file you checked locally and runs it in NeoLoad Web. The commands work the same way in your terminal and in a pipeline. This topic explains how to connect the CLI to NeoLoad Web, create the test, upload the project, run it, and read the results.
Before you start
To run an as-code test in NeoLoad Web, you need the following:
-
A NeoLoad Web URL and an API token.
-
A workspace, and a load zone with load generators available in it.
-
Enough license capacity for the virtual user resources the test run consumes.
-
A project whose user paths already pass locally.
-
A YAML file that defines populations and scenarios. Local checks don't use them, so add them before you run the test.
Sign in to NeoLoad Web
Connect the CLI to your NeoLoad Web workspace:
neoload login --url <server-url> --workspace "<workspace>" <token>
The CLI keeps the connection, so the commands after this one don't repeat the URL or the token.
Treat the token as a password. In a pipeline, read it from your secret store rather than writing it into the command, so it stays out of your job logs.
Create the test
Create a test in NeoLoad Web and choose the load zone, the number of load generators, and the scenario it uses:
neoload test-settings --zone <zone> --lgs <count> --scenario <scenario> create <test-name>
Set the following options:
-
--zone is the load zone that supplies the machines.
-
--lgs is how many load generators to reserve.
-
--scenario names a scenario from your YAML.
Upload the project
Upload the project file from your repository to the test you created:
neoload project --path default.yaml upload <test-name>
Replace default.yaml with the path to your project file. The --path option belongs to project, so put it before upload. Run this command again whenever you change the YAML, so the test always uses the current version.
Run the test
Run the test with one of the scenarios from your YAML:
neoload run --scenario <scenario> <test-name>
The test run consumes virtual user resources from your license. Run a local check first, so you only spend resources on a user path that works.
Read the results
Show a summary of the finished test run in your terminal:
neoload test-results summary
The summary shows throughput, response times, error rates, and the results of your service level agreements (SLAs). The full result stays in NeoLoad Web, where you can compare it against earlier runs.
What's next
To catch a broken user path on every commit, before it reaches a load test, automate as-code checks in your pipeline.