In this tutorial you’ll learn how to customize a test case so that each virtual user logs into WordPress with a separate account.
1. Record Test Case
Start recording by clicking on the red record button, and navigate to http://demo.webperformance.com.
This of course goes to the login screen, where the username is “demo”, and the password is “p@perdoll”.
Clicking the blue “Log In” button will take you a form where you can make a blog post:
Click Publish, and then log out by clicking in the upper right-hand corner and selecting Log Out from the menu:
The test case is over, so stop the recording by clicking on the black stop button:
2. Create Dataset
Now that the test case is recorded, its time to customize it so that each virtual user has a separate username, password, and blog post title. This type of customization information is kept in a “dataset”, or a collection of data in rows and columns like a database. Datasets are stored in the Datasets folder in the Navigation Tab:
In this tutorial you’ll be shown how to create the needed dataset, but if you want to save time, feel free to use the provided dataset with the title “Login and Post on Blog”, and skip down to Section 3, Customize Test Case.
If you want to learn how to create a dataset, right-click on the repository, and select New->Dataset:
The dataset editor will now show up in the main window area. Next, you’ll want to rename the default field name “field” to be “Username” by first clicking on the Field column, below:
and then clicking on the field name editor icon in the middle:
which brings up editor:
Click on the green cross to add one more field named “Blog Post Title”.
The next step is to generate values for each column. Start by clicking on the “Username” field and then clicking fill:
You can create data in several different ways. In this case it makes sense to use a sequence from 1 to 25 with a prefix of “user”:
Click the “Generate values” button to generate the parameters, and then “OK” insert them into the Username field.
Next, click on the head for the Blog Post Title field, and click on the “Fill” button again. Again, just the sequence method from 1 to 25 and a prefix to create unique blog post titles. (Anything would do, as long as its unique.)
Click “OK”, and the dataset should look like this:
The final step is to rename the dataset from “New Dataset” to “Logins” by right-clicking on the dataset in the Navigator Tab and selecting “Rename”.
3. Customize Test Case
Once there’s a dataset, the next step is to locate the parts of the test case you want to customize. First up is the login page, which you can find by clicking on the web pages until the following appears in the Content Tab:
Click on the Username field, and the field configuration dialog pops up. Set the Datasource to be “Dataset”, and select either the dataset you configured or the provided dataset “Login and Post on Blog”, and then select the Username field.
Next, select the page after that with the form for creating a blog post:
Click on the blog title form, which should “enter title here” in light grey, and again bring up the field configuration dialog. Use the same dataset as before, but this time select the field with the title ”Blog Post Title”.
4. Replay Test Case
After any customization of a test case you’ll want to see it work with a single user before doing a load test. Use the down arrow on the button to select various replay options such as Fast Play.
If the replay was successful you’ll see this at the bottom of the test case window:
At this point click on the “Rewind” button to view the original load test:
5. Load Test
To start a load test from the test case window, click on the Load Test button:
This will bring up the load test configuration dialog:
Click ok to go to the main load test window where you click on the Start button to start the load test.