Integrating Runscope with Ghost Inspector

Ghost Inspector is a powerful but simple tool for automated website testing. Ghost Inspector tests check specific functionality in your website or application and execute continuously from the cloud and alert you if anything breaks.


Connecting Your Accounts

From your API test, select Integrations and click Connect Ghost Inspector. You will be prompted to complete the authorization flow to grant Runscope access to your Ghost Inspector account. If you have multiple Ghost Inspector accounts you can create multiple connected services.


Adding UI Test Steps

Once connected a new option will appear in the Test Steps editor allowing you to add a Ghost Inspector test step as part of your API test. After adding the step, select the test you want to execute from the dropdown list.


Creating Assertions

Assertions can be created on the data generated by the Ghost Inspector test step. A JSON object containing data from the test run can be evaluated using the JSON syntax used in assertions for HTTP request steps. An assertion for the status of the UI test run is created by default.


Creating Variables

Data from the test run can be extracted and stored in a variable for use in subsequent requests. The same syntax for extracting data from HTTP request steps can be used for extracting data from the Ghost Inspector test run JSON result.


Creating Scripts

To evaluate the Ghost Inspector test run result JSON with a Script, access the request.body value:

// parse JSON result data into object
var data = JSON.parse(request.body);

After parsing the data, you can access it to create script assertions or variables using the same code as you use for scripts attached to HTTP request steps.


Changing the Start URL

The start URL of your Ghost Inspector test can be optionally overridden with an alternate URL. You can enter a URL, or pass variables from Runscope into your Ghost Inspector test as a start URL. Learn more about reusing Ghost Inspector tests across different environments.