JavaScript Definition
2 minute read
The following is intended to help understanding of the execution environment that is used to evaluate the JavaScript definition of your test case.
The test code you provide is used to generate a test configuration containing a description of your targets, arrival phases as well as test scenarios and steps.
JavaScript Environment
The JavaScript definition that is used to describe the test case is executed only ONCE by our API when saving your test case or uploading via the stormforge
CLI tool.
There is no JavaScript being executed when a test is running.
This means the JavaScript is executed once before you actually run a test case and without any concrete test data or other state.
Functions like getVar()
or session.ds.generateFrom()
return internal placeholders that will be replaced during the actual test run execution later.
You can use helpers like session.if()
or session.times()
to control the flow of your sessions.
Note that the JavaScript environment is a minimal environment, so you will not find any browser APIs (like window
or navigator
) nor any other system APIs like in a Node.js context.
It is also not possible to load any external JavaScript libraries.
JavaScript DSL
Inside the JavaScript definition you can define your test case by interacting with the global definition
variable that is provided.
See the following articles for the various elements you can define via the API: