Initial Script
For each test and shared environment, you can specify a script that runs prior to the first request of an API test. If you have a complicated signature or other value that needs to be generated and is common to all requests (e.g. random number generator), this is the place to define it. The initial script is processed after the Initial Variables are processed and has access to those values through the variables
global. Any variable values set with variables.set(name, value)
will be available to the requests in the test. Any assertions defined in the initial script will be ignored.
An Initial Script specified in the shared environment will be executed before the Initial Script defined in an individual test environment, if the shared environment is inherited by that test environment.
Using the AI Script Assistant
Adding the advice for writing a good query: -
User query should be related to the JavaScript code/script generation in context of Runscope(API Monitoring) tool only. AI model will reject the query with this error message Unable to generate a valid response for the given input. Please ensure the input is related to generation of scripts in case of any deviation from the expected behaviour.
If users want to store/get any kind of data in/from the Runscope variable then they have to mention this in the query. For example: - Assert the response status code is 200 and assign it to a Runscope variable. If they don’t mention Runscope variable then AI model might assign the value to JS variable. Remember syntax is different to assign values to a JS variable or Runscope variable.
For now, I have these 2 points only along with usual advice to make the user input crisp and clear.