Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Project Hurricane is a command line tool or web-based service for creating and scheduling load tests of HTTP based APIs. This tutorial will primarily cover using the web-based service. A specific command line related section is provided at the end. The tests are defined in JSON format and provide support for many different features:

...

Test properties allow you to create placeholders into in your scripts that get replaced when the test is run. This makes it easy to create tests that can be run in against multiple environments such as Dev, QA, or Production without having to change the test definition each time or have separate definitions for each environment.

...

It's important to understand the differences between properties and variables and how they are used in a test script. The first difference is where the values for properties and variables come from. Property values are provided at test scheduling time, either through specifically providing a value or using the default value provided by defined in the test definition. Variable values are extracted from request responses while the test is running.

...

  1. Click on the “Add” button in the Test Properties section of the Edit Test Definition page. This adds an empty property entry to the page

  2. Provide a name for the property. For this tutorial we’ll use “ServerDomain”. The name will be used as part of the placeholder and can only contain letters, numbers, ‘-', and '_’

  3. Optionally provide a default value to use for this property if a specific value isn’t given during test scheduling. For this tutorial we use our current server address: “http://localhost”

  4. Once added, click the “Save” button at the bottom of the page

Reference a Test Property

To use our new test property, we need to add a reference to it in our test’s main script. A property reference has the format {{propertyname}}. In our example, we change the “url” field of our request to include a reference to the ServerDomain property:

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "Hello World",
			"type": "Request",
			"method": "GET"
			"url": "{{ServerDomain}}/hello",
			"body": null,
			"actions":
			[
			]
		}
	]
}

Just before the test is run, the {{ServerDomain}} portion of the “url” field will be replaced with the value of our property. In this case the “url” field value would be rewritten to “http://localhost/hello”. If the test was run against a QA environment, the value might be overwritten to “http://myqaserver”. Now our test can be pointed at any number of different servers at run time without having to change the test definition itself.

Info

Not all fields support property and variable reference replacement. To see if a specific field supports this feature, please see the detailed documentation for each type of script element.

Warning

Nesting property references is not supported. The results will be indeterminate.