After you created a project in LoadNinja, you need to create a test. In LoadNinja, you can create UI tests or API tests:
A UI test (or script) is a sequence of user actions – mouse movements, clicks, keystrokes, and so on – to be simulated on the tested website. You create these tests by recording user actions on the tested web pages. You can record multiple UI tests for your project.
An API test is a sequence of HTTP or HTTPS requests to be sent to the tested web service. You create these tests by entering request parameters manually.
Let’s record a UI test:
On the Tests tab of the project screen, click Create Test and select UI test from the context menu:
In the subsequent dialog, you 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 UI test on a sample pet store web application:
Enter the URL and select the 1366×768 resolution:
The dialog box has two more settings:
From the drop-down list, you can select the location to use for the recording and further playback. This is helpful when you need to check how your website works for users located in different regions of the world. By default, LoadNinja selects the region that better matches your location. Let’s keep this default value.
Web applications that reside in your local network or on your computer require special recording steps. Select the This website is not publicly available check box, start recording and follow the instructions you will see on the screen. For more information, see Test Web Apps in Local Network.
The tested app we use in our tutorial is publicly available, so we can keep the check box unselected.
OK, 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 UI test, 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 test (see Recording UI Tests - Best Practices for more information).
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 test (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.
If you’ve recorded a test for the first time, LoadNinja will display a message box suggesting that you run the test at least once to ensure it works as expected. (If you recorded tests earlier and selected Don’t show again in the message box, you will not see it.)
The playback will start automatically. We don’t recommend skipping it. If for some reason you decided to play back the test later, you can do this any time by clicking Play at the top left of the recorder screen.
Use the Playback Log at the bottom of the recorder screen to immediately check how your website responds to your test’s commands.
At the end of the run, LoadNinja shows the short excerpt of the playback results:
If everything is OK, click Save and Run Load Test to create a load test scenario.
If errors occurred, fix them before you proceed.
In the subsequent dialog, enter the name of your test (select a descriptive name), and make sure that your project is selected in the Project drop-down list. Then, click Save Test and Continue:
OK, you have recorded and saved your first UI test. Now, we will create a load testing scenario.