|
During end-to-end testing, you will require unique test data to validate the accuracy of your test cases. Writing custom functions to do this is one way, but what if your test automation tool provided an easy solution to this requirement? You can achieve this with testRigor through single-line English commands. Let’s take a look at how to go about it.
Pre-requisites to writing the test case
First and foremost, you need to create a test suite. Depending on the type of app you are testing, testRigor will ask you for details during test suite creation. Here are the general fields that will be visible to you during this process.
Step 1: Log in to your testRigor app with your credentials.
Step 2: Set up the test suite for the website testing by providing the information below:
- Test Suite Name: Provide a relevant and self-explanatory name.
- Type of testing: Select from the following options: Desktop Web Testing, Mobile Web Testing, Native and Hybrid Mobile, based on your test requirements.
- URL to run test on: Provide the application URL that you want to test.
- Testing credentials for your web/mobile app to test functionality which requires user to login: You can provide the app’s user login credentials here and need not write them separately in the test steps then. The login functionality will be taken care of automatically using the keyword login. However, this is an optional field and can be skipped if not relevant.
- OS and Browser: Choose the OS Browser combination on which you want to run the test cases.
- Number of test cases to generate using AI: You can simplify your test creation further by opting to generate test cases based on the App Description text. This feature works on generative AI.
This is how the test suite creation screen will look like.
![](https://testrigor.com/wp-content/uploads/2024/04/How-to-generate-unique-test-data-in-testRigor-IMG1.png)
Step 3: Click on Create Test Suite.
Note: On the next screen, you can let AI generate the test case based on the App Description you provided during the Test Suite creation. However, for now, select do not generate any test, since we will write the test steps ourselves.
Step 4: To create a new custom test case yourself, click Add Custom Test Case.
![](https://testrigor.com/wp-content/uploads/2024/04/How-to-generate-unique-test-data-in-testRigor-IMG2.png)
Test Case: Filling a form using unique test data
In the following test case, we will use testRigor’s unique data generation commands to fill the form.
Test Steps
Step 1: Come to the Test Cases section, provide the test case Description, and start adding the test steps. We will add test steps in the test case editor screen.
Step 2: Since we provided the website URL during test suite creation, testRigor automatically navigates to this website. There is no need to use a separate function to open the URL. The website’s homepage will look like this.
![](https://testrigor.com/wp-content/uploads/2024/04/How-to-generate-unique-test-data-in-testRigor-IMG3.png)
Step 3: We will use the ‘generate from template’ command to create a custom structure for the unique name we want. testRigor uses four different symbols to indicate the types of data you want to generate.
Symbol | Type of data |
---|---|
# | Generates a random number in the range 0-9 |
$ | Generates a random lowercase letter in the range a-z |
% | Generates a random upper case letter in the range A-Z |
* | Generates a random alphanumeric symbol, either a number or lower or upper case letter (0-9, a-z, A-Z) |
generate from template "%$$$$$$$", then enter into "First Name" and save as "generatedFirstName"
generate from template "%$$$$$$$", then enter into "Last Name" and save as "generatedLastName"
generate from template "$********####@email.com", then enter into "Email" and save as "newEmail"
Alternatively, if you use the command ‘generate unique email, then enter into “Email” and save as “newEmail”‘ testRigor will create a unique email address with testrigor-mail.com as the domain.
generate from template "##########", then enter into "Mobile" and save as "generatedPhone"
generate from template "%-$$$$$, %$$$$$, ####, %$$$$$$$$$$$$$", then enter into "Current Address" and save as "generatedAddress"
Here’s how the unique data-filled sections appear.
![](https://testrigor.com/wp-content/uploads/2024/04/How-to-generate-unique-test-data-in-testRigor-IMG4.png)
Complete test case
generate from template "%$$$$$$$", then enter into "First Name" and save as "generatedFirstName" generate from template "%$$$$$$$", then enter into "Last Name" and save as "generatedLastName" generate from template "$********####@email-mail.com", then enter into "Email" and save as "newEmail" generate from template "##########", then enter into "Mobile" and save as "generatedPhone" generate from template "%-$$$$$, %$$$$$, ####, %$$$$$$$$$$$$$", then enter into "Current Address" and save as "generatedAddress"
![](https://testrigor.com/wp-content/uploads/2024/04/How-to-generate-unique-test-data-in-testRigor-IMG5.png)
Viewing Test Results
Once the test is executed, you can view the execution details, such as execution status, time spent in execution, screenshots, error messages, logs, video recordings of the test execution, etc. In case of any failure, logs and error text are available easily in a few clicks.
![](https://testrigor.com/wp-content/uploads/2024/04/How-to-generate-unique-test-data-in-testRigor-IMG6.png)
You can also download the complete execution with steps and screenshots in PDF or Word format through the View Execution option.
testRigor’s Capabilities
The above example shows how convenient it is to create unique data using testRigor. However, you can do a lot more with testRigor.
- RegEx-based data creation: Besides the simple test data generation that we saw above, testRigor provides full support for Java-like regular expressions with POSIX character classes and full multibyte Unicode support for international characters. Here’s an in-depth guide for RegEx Random String Generation.
- Reusable Rules (Subroutines): You can easily create functions for the test steps that you use repeatedly. You can use the Reusable Rules to create such functions and call them in test cases by simply writing their names. See the example of Reusable Rules.
- Global Variables and Data Sets: You can import data from external files or create your own global variables and data sets in testRigor to use them in data-driven testing.
- 2FA, QR Code, and Captcha Resolution: testRigor efficiently manages the 2FA, QR Code, and Captcha resolution through its simple English commands.
- Email, Phone Call, and SMS Testing: Use simple English commands to test the email, phone calls, and SMS. These commands are helpful for validating 2FA scenarios, with OTPs and authentication codes being sent to email, phone calls, or via phone text.
- File Upload/ Download Testing: Execute the test steps involving file download or file upload without the requirement of any third-party software. You can also validate the contents of the files using testRigor’s simple English commands.
- Database Testing: Execute database queries and validate the results fetched.
Additional Resources
- Access testRigor documentation to learn about more useful capabilities
- Top testRigor’s features
- How to use simple templates to generate unique data?
- How to do data-driven testing using testRigor?
- Data-driven Testing: How to Bring Your QA Process to the Next Level?
- How to perform end-to-end testing?