Using Eggplant Performance Test Controller with the REST API
All of the actions that you can perform in the Eggplant Performance Test Controller user interface (UI) can also be automated by using the REST API. This ability could be useful if you run performance tests on a regular basis and want to automate the process. For example, you could use the REST API to integrate Eggplant Performance into a continuous integration (CI) environment.
Starting the REST Server
The REST server is a standalone web server that listens for HTTP requests on a specified port. The path to the REST server is as follows:
C:\Program Files (x86)\eggPlant Performance\TestControllerServer\bin\testControllerServer.exe
To start the REST server, run testControllerServer.exe from the command line. By default, the REST server listens for requests on port 5001. You can specify a different port by using the -p command line option:
testControllerServer.exe -p 8888
Sending Requests to the REST Server
HTTP requests should be directed to the host and port on which the REST server is listening. In addition, you need to specify the path of the particular method you wish to execute. For example, to list all the available workspaces on the server, you would send an HTTP GET request to:
All responses received from the REST server have the MIME type application/json. For example, the request above would generate a response such as:
"Demo Workspace": "/test_controller/api/1.0/Demo%20Workspace"
You can parse the response to extract the information you need. For example, the response above tells you the URL to go to for information on the workspace named Demo Workspace.
Each HTTP response also has an HTTP response code. A code in the 200 range (e.g., 200, 201) indicates that the request was successful. A code in the 400 range (e.g., 400, 404) indicates that there was a problem with the HTTP request that was sent.
If a particular method requires you to send a POST request, then any POST data should be sent with the Content-Type application/json, and the POST data should be encoded in JSON format. For example, to start a test run, you would send a request such as:
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
"series": "Default Series"