Getting Started - Script

Follow this guide for a basic example with a Node.js Script scenario. Node.js scripts are written in Javascript and execute in a sandboxed Node.js environment. You can start from scratch or convert a Recording into a script as a starting point.

Start by signing up for an account and logging in if you have not already done so.

Create New Test Case

After logging in you should see a Create Test button on the dashboard. Click on it to get started. There are four steps: Name, Scenario, Configuration, and Results. We will examine each step one by one below.

For the sake of this test we will use our example REST API endpoint found at http://sample.testable.io. Give the test a name like ‘Demo’ and press enter or next.

Scenario

The scenario is the set of steps that will be executed during your test. In this guide we will choose the Node.js Script option.

Quite a few templates are provided to get you started quickly. Let’s choose Request Module -> HTTP GET. Some code should be inserted into your script for an HTTP request to http://sample.testable.io/stocks/IBM:

request.get('http://sample.testable.io/stocks/IBM')

Try your script out by clicking the Smoke Test button in the upper right. This will execute your script one time on one of our Testable test runners and show you the results it captured.

Smoke test

Look at all those metrics from our one line of code! Now let’s turn this into a real load test. Click on the Configuration tab or press the Next button at the bottom.

Configuration

Now that we have the scenario for our test case (i.e. GET http://sample.testable.io/stocks/IBM) we need to define a few parameters before we can execute our test:

  1. Total Virtual Users: Number of users that will execute in parallel. Each user will execute your Node.js script.
  2. Test Length: Select Iterations to have each client execute the scenario a set number of times regardless of how long it takes. Choose Duration if you want each client to continue executing the scenario for a set amount of time (in minutes).
  3. Location(s): Choose the location in which to run your test and the test runner source that indicates which test runners to use in that location to run the load test (e.g. on the public shared grid).

And that’s it! Press Start Test and watch the results start to flow in. See the new configuration guide for full details of all configuration options.

For the sake of this example, let’s use the following parameters:

Test configuration

View Results

Once the test starts executing, Testable will distribute the work out to the selected test runners (e.g. Public Shared Grid in AWS N. Virginia).

Test results

In each region, the Testable test runners execute the scripted scenario with 5 concurrent clients 20 times through. As a reminder the recorded script in this case involves executing the following steps against http://sample.testable.io:

  1. GET /stocks/IBM

We can see from the results that each resource was requested 100 times (5 concurrent clients * 20 iterations). 100% of the requests completed successfully at a median latency of 5ms.

Surrounding the resource result grid you can see various graphs. If you click on any resource in the grid, the charts below will update to be specific to that resource only.

We offer integration (Org Management -> Integration) with third party tools like New Relic. If you enable integration you can do more in depth analytics on your results there as well.

That’s it! Go ahead and try these same steps with your favorite website or API and feel free to contact us with any questions.