After you created a project in LoadNinja, you need to create scripts. A script is a sequence of user actions to be simulated on the tested website. In LoadNinja, you create scripts by recording them. You can record multiple scripts in your project. You then include scripts into a load test to have virtual users simulate different visitor workflows on the website. In this tutorial, we will record just one scripts. You can record more once you learn how it works.
In LoadNinja, you can start recording from multiple locations: from the topmost toolbar, from the project screen, or from the Dashboard. For now, let’s stick on the project screen. To start recording:
On the Web Tests tab of the project screen, click Record:
In the subsequent dialog, you first need to specify whether the application you want to test is External (available to Internet users), or Internal (located within the local network of your company).
This tutorial describes how to create script for an external web application, so select this option for now. To learn about recording tests against internal web applications, see Test Web Apps in Local Network With Endpoint.
Next, you need to specify the URL of the web page from which your test will start, and select a screen resolution for the recording (some web applications may look and behave slightly differently on different screens).
In our example, we will record a script on a sample pet store web application:
Enter the URL and select the 1366×768 resolution. Ready to go? Click Start Recording.
You are now on the recorder screen. You see the tested web application on the right (in the internal browser area), and the recorded events on the left:
To record a script, work with the tested web application in the internal browser as an end-user will work with it: click links, enter text, scroll pages, and so on. LoadNinja will be recording your actions and include them into the script.
For example, let’s test the login system of the application:
Click Log in.
In the Returning Customer form, specify these credentials:
Click Sign in.
LoadNinja will record all these actions. You will see them on the left. The parent node corresponds to the web page, child nodes correspond to user actions and other events.
In LoadNinja, the parent nodes are called Steps. In single-page web applications, parent nodes correspond to application screens.
Let’s record some more actions. Let’s check if our pet store offers poodle puppies: click within the search box at the page’s top, enter
poodle there, and click Search:
Now, we need to check if the search results have any information. To do this, let’s add a validation to our script (validations help you check the server responses and verify that the tested web application works as expected). In our case, the validation should check whether the search result web page contains the word “Puppy”. To add this validation:
Select Add > Validation on the toolbar on the left.
In the subsequent Add Validation dialog, select the Text validation type.
Enter the validation name.
Select the Page Contains validation type, and then specify
Puppy in Value.
Click Test to make sure the validation works. Then, click Add. You will see the validation added to the Search for Poodle test step:
Click to finish the recording for now.
You can click Play to run the recorded script to check it works correctly. The dialog that appears at the end of the run shows the short excerpt of the playback results.
Click Save and Run Load Testю
In the subsequent dialog, enter the name of your script (select a descriptive name), and make sure that your project is selected in the Project drop-down list. Then, click Save Script and Continue:
OK, you have recorded and saved your first script. Now, we can create a load testing scenario.