Versions Compared

Key

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

...

When you first access the Hurricane service you will see the list of previously created test definitions.

...

Let’s create a new test:

  1. Enter a name for your test in the Name field at the bottom of the page

  2. Click the “Add Test Definition” button

Your test is created using the name you provided and you are redirected to the Edit Test Definition page.

...

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

...

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

...

Let’s add a property to our test that will hold the protocol and server information for our API request. To add a test property:

  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

...

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

...

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "Echo",
			"type": "Request",
			"method": "POST",
			"url": "{{ServerDomain}}/echo",
			"headers": [],
			"body":
			{
				"text": "My text content"
			},
			"actions":
			[
			]
		}
	]
}

...

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "Echo",
			"type": "Request",
			"method": "POST",
			"url": "{{ServerDomain}}/echo",
			"headers":
			[
				{
					"name": "Content-Type",
					"value": "application/json"
				}
			],
			"body":	"{\r\n\"text\": \"My text content\"\r\n}",
			"actions":
			[
			]
		}
	]
}

...

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "Hello World",
			"type": "Request",
			"method": "GET",
			"url": "{{ServerDomain}}/hello",
			"body": null,
			"actions":
			[
			]
		},
        {
			"name": "Echo",
			"type": "Request",
			"method": "POST",
			"url": "{{ServerDomain}}/echo",
			"headers":
			[
				{
					"name": "Content-Type",
					"value": "application/json"
				}
			],
			"body":	"{\r\n\"text\": \"My text content\"\r\n}",
			"actions":
			[
			]
		}
	]
}

...

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "Hello World",
			"type": "Request",
			"method": "GET",
			"url": "{{ServerDomain}}/hello",
			"body": null,
			"actions":
			[
				{
					"name": "Capture Result",
					"type": "json",
					"extractionPairs":
					[
						{
							"jsonPath": "text",
							"variableName": "myvar"
						}
					]
				}
			]
		},
        {
			"name": "Echo",
			"type": "Request",
			"method": "POST",
			"url": "{{ServerDomain}}/echo",
			"headers": [],
			"body":
			{
				"text": "My text content"
			},
			"actions":
			[
			]
		}
	]
}

...

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "Hello World",
			"type": "Request",
			"method": "GET",
			"url": "{{ServerDomain}}/hello",
			"body": null,
			"actions":
			[
				{
					"name": "Capture Result",
					"type": "json",
					"extractionPairs":
					[
						{
							"jsonPath": "text",
							"variableName": "myvar"
						}
					]
				}
			]
		},
        {
			"name": "Echo",
			"type": "Request",
			"method": "POST",
			"url": "{{ServerDomain}}/echo",
			"headers": [],
			"body":
			{
				"text": "[[myvar]]"
			},
			"actions":
			[
			]
		}
	]
}

...

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "Hello and Echo",
			"type": "Sequence",
			"headers": [],
			"steps":
			[
                {
					"name": "Hello World",
					"type": "Request",
					"method": "GET",
					"url": "{{ServerDomain}}/hello",
					"body": null,
					"actions":
					[
						{
							"name": "Capture Result",
							"type": "json",
							"extractionPairs":
							[
								{
									"jsonPath": "text",
									"variableName": "myvar"
								}
							]
						}
					]
				},
                {
					"name": "Echo",
					"type": "Request",
					"method": "POST",
					"url": "{{ServerDomain}}/echo",
					"headers": [],
					"body":
					{
						"text": "[[myvar]]"
					},
					"actions":
					[
					]
				}
			]
		}
	]
}

...

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
		{
			"name": "HelloPick and EchoOne",
			"type": "SequenceRandom",
			"headers": [],
			"steps":
			[
                {
					"name": "HelloCall World1",
					"type": "Request",
					"method": "GET",
					"url": "{{ServerDomain}}/hellocall1",
					"body": null,
					"actions":
					[
					]
				},
                {
							"name": "CaptureCall Result2",
							"type": "jsonRequest",
							"extractionPairsmethod": "GET",
							[
								{
	"url": "{{ServerDomain}}/call2",
								"jsonPathheaders": "text"[],
									"variableNamebody": "myvar"null,
					"actions":
			}
		[
					]
						}
					]
				},
      
         {
					"name": "EchoHello World",
					"type": "Request",
					"method": "POSTGET",
					"url": "{{ServerDomain}}/echo",
					"headers": []hello",
					"body": 					{
						"text": "[[myvar]]"
					},
		null,
			"actions":
					[
					]
				}
 			]
		}
	]
}   ]
}

When this test is run, the Random group step is executed first. The group will pick either Call 1 or Call 2 to execute. The test then moves on to execute the Hello World step. During the next loop, the Random group will make another random selection.

Using the Initial Script

The Initial script is used to perform any setup tasks required by the Main script such as authentication or gathering data to use in variables. It is run prior to the Main and Maintenance scripts and unlike the other scripts, the initial script is only executed once. Let’s look at an example that uses the Initial script to perform authentication that will be used by the requests in the Main script:

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
        {
			"name": "Authenticate",
			"type": "Request",
			"method": "POST",
			"url": "{{ServerDomain}}/login",
			"body": 
			{
				"username": "{{username}}",
				"password": "{{password}}"
			},
			"actions":
			[
			]
		}
    ]
}

The login endpoint sets a cookie that contains the authentication token. This cookie will be sent as part of any requests made by the Main or Maintenance scripts automatically. Note that cookies set in the Initial and Maintenance scripts are global and shared with all sessions running the Main script. Unlike Main script cookies they will not be cleared between session loops. The Initial script is great for authentication, but what if that authentication will expire before the test has finished? Some tests might take several hours to complete. This is where the Maintenance script comes into play.

Using the Maintenance Script

The Maintenance script and delay are used to perform periodic actions that support the Main script. The platform will wait for the delay period before running the Maintenance script for the first time. Once it it complete, it will be run again after the same delay period. This loop will continue until the Main script has finished. In this example we’ll use the Maintenance script to refresh our authentication cookie every 10 minutes:

Code Block
languagejson
{
	"headers": [],
	"steps":
	[
        {
			"name": "Refresh Authentication",
			"type": "Request",
			"method": "GET",
			"url": "{{ServerDomain}}/refreshlogin",
			"body": null,
			"actions":
			[
			]
		}
    ]
}

In this case we don’t need to send any additional information because our /refreshlogin endpoint will receive the cookie that was set by the Initial script (it is shared globally) and set an updated cookie value during the response. The updated cookie is also shared globally so any new requests made by the Main script will use the new value.

Info

The Maintenance Delay field is the amount of milliseconds between Maintenance script runs.