Create a Transaction with Randomized Web Form Data
This article covers the topic of creating a Transaction that submits a web form with randomized field data each time it is run. This is useful for testing web forms that create user accounts or subscriptions.
Part 1: Record a Transaction
- In WebWatchBot Manager, select the menu options: File -> New -> Record a Transaction
- The Transaction Recorder window will open:
- For the purposes of this article, the following URL will be used to demonstrate the randomization functionality: http://www.exclamationsoft.com/webwatchbot/testing/transaction/login.html
- Enter the URL and press ENTER or click the button "Go"
- The login page will load
- Enter "username" in the username field
- Enter "password" in the password field
- Click the "Submit" button
- The entered data will appear on the subsequent page
- Save the recorded Transaction by clicking "Save and Close" on the toolbar. This will save two steps for the Transaction.
- Click OK to save the Transaction
- The Transaction will appear in the Watch List with a Summary and 2 Transaction steps.
Part 2: Configure the Transaction for Random Data
- In the Watch List, select the second Transaction step. This step POSTs the form data to the web form.
- Right-click on the second Transaction step and select "Properties" from the menu
- The Watch Item Properties window will appear
- Click the "Settings" button
- The "HTTP Settings" window will appear
- Select the "Form" tab
- Note the POST data that contains the following string username=username&password=password&submit2=Submit
- For this article, the username will be randomized with letters and numbers.
- Change the text "username" after the equal sign to (*TEXT:6*)(*INTEGER:2*).
- The new POST data should be: username=(*TEXT:6*)(*INTEGER:2*)&password=password&submit2=Submit.
- This will create a random username with 6 letters and 2 numbers.
- Click the OK button twice to close and save the Watch Item
Part 3: Test Results
- Select the Transaction's Summary in the Watch List
- On the toolbar, click the "Run Now" button
- Each step in the Transaction should have their action change from "Sleeping" to "Running".
- When the second Transaction step completes running, select the "Output" tab at the bottom of the WebWatchBot main window
- The browser output should show a different username
- Run the Transaction again to test for more randomized results
- Change the values of other form data, such as the password, to see other fields with randomized results.
- Form data randomization was introduced in version 5.0.3.
- Types of replacement tags available:
- The number specified is the length of either the text string or the number
- Decimals can have a precision (digits after the decimal symbol) of up to 9.
- The maximum length of a decimal and integer is 20.