Manage Test Data

Manage Test Data

Introduction

The Test Data functionality allows testers to execute the same test case multiple times with different data inputs; without having to create duplicate/repeated test cases. It replaces the traditional practice of entering hard-coded input values with parameters. Test Data allows QA teams to store reusable test data in one centralized location and import existing parameters and data sets. Managing test cases with test data is one of the ways to make your tests consistent and manageable. You can create automated data-driven tests quickly using Test Data in QAS.

Example

The following values need to be validated against Username and Password in the Login test case.

Username

Password

Username

Password

David

admin123!

Liza

admin123$

Mathew

admin123%

Create Test Data

Users can create internal test data (CSV) to use in test cases.

Expand the Test Data section on the tree at the left.

You can add a new file for test data in the existing folder or you can also add a new folder and then add the test data file in it.

Options available on the folder structure:

  • Add New Folder

  • Add New Test Data

  • Refresh Folders

  • Collapse Folders

 

Right-click options available on the Test Data Folder

Once you create a test data folder, right-click on it to see the following options:

  • Create New File: Create new test data under the selected test data folder.

  • Create New Folder: Create a sub-folder under the current folder.

  • Cut: Cut the folder to paste it.

  • Copy: Copy the folder to paste it.

  • Paste: Paste the cut/copied folder.

  • Rename: Rename the current folder.

  • Delete: Delete the current folder.

 

Right-click options available on the Test Data

  • Cut: Cut the test data file to paste it.

  • Copy: Copy the test data file to paste it.

  • Paste: Paste the cut/copied test data file.

  • Rename: Rename the current test data file.

  • Delete: Delete the current test data file.

You can create test data in either of the following ways:

  • Import test data file into QAS

  • Import from Test Data Connection

  • Create test data manually


Import Test Data Manually

You can import readily available CSV file containing test data in it.

Note: The maximum allowed file size is 200 KB.

Steps

  1. Select the test data on the tree.

You can see three options to create test data.

2. Select the Import Test Data Manually option.

3. To attach the test data file, you can either drag & drop the file in the given area or browse the file and select it.

You can see one record of the file is added on the screen displaying the Name and Size of the file.

4. Click on the Upload button to upload the file.

 

Once the file is imported, the test data starts displaying on the screen. You can then link this test data to test cases.

Import from Test Data Connection

The option is provided to let you import the test data using a database connection. It empowers users with the ability to establish direct database connections. With this capability, users can retrieve test data in real-time or offline, enabling them to create data-driven test cases. This enhancement significantly enhances the flexibility and efficiency of testing, as users can now leverage live or cached data directly from the database for their test scenarios. By enabling data-driven testing, this feature allows for more robust and comprehensive testing, ultimately leading to improved product quality and accelerated testing processes.

Users can configure, query, and use test data from MySQL database tables. QAS supports Test Data in projects to make use of test data in test cases.

Users can connect database for importing test data for execution. The feature lets users use the test data directly from the existing database. Users can also write a query and fetch the required data in QAS. QAS test cases are executed using this test data.

You can define SQL statements to retrieve the data from the databases and manage the data inside the Test Data module. You get two options to retrieve the data (a) Real Time and (b) Offline.

You have to -

  • Create Test Data Connections

  • Retrieve Data

Create Test Data Connection

1. Go to Project Settings > Test Data Connections.

The screen opens, which lets you create a new SQL connection for test data.

2. Click on the Create button.

3. Enter the details:

  • Name: Give a name to the SQL connection for identification.

  • Select Data Type: Select “MySQL” data type on the drop-down.

4. Click Create.

The record is displayed on the screen.

5. Open the connection record by clicking on the Key.

6. Enter details to configure the database connection.

7. Test the connection by clicking on the Test Connection button at the top right corner.

Once the test data connection is established, enable the status of the test data connection to use it for test data.

Retrieve Test Data using the Database Connection

1. Go to the Test Data module.

2. Click on the Import from Test Data Connection section.

3. Click on the Select Connection button on the next screen to map the database to refer to the test data.

In case you do not have a database connection, then the panel opens with instructions to go to the Project Settings module for setting up the connection.

If you already have the database connection, the Link Connection panel opens showing the database connections.

4. Select the required database connection you want to map with the test data.

The mapped database connection name is displayed at the top.

There are two options to get the test data retrieved from the database: (A) Release time and (B) Offline.

(A) Realtime data retrieval

You can execute the query and save it for future reference. The queries are executed and synced with the database each time before test case execution.

Steps:

1. Write the query in the box and click on the Execute button.

The query result is displayed on the screen.

You can save the query for your future reference so that you do not have to write it again.

2. To save the query on the screen, click on the Save Query button.

(B) Offline data retrieval

You can execute the query and save the query result. The query results are saved in QAS and the same is used in test data while test case execution. The data will not be synced with the database for every execution.

Steps:

1. Write the query in the box and click on the Execute button.

The query result is displayed on the screen.

You can save the query result for the current test data file and use the saved result for the test data.

2. To save the query result for the test data, click on the Save Result button.

The query result gets saved as manual test data.

You can manage columns of the test data like other manual test data by clicking on the Manage Columns button.

Create Test Data Manually

Follow the steps mentioned below to create test data manually.

1. To create test data manually, first open the test data file by selecting it on the tree.

2. Click on the Create Test Data Manually option.

The Manage Columns panel opens.

 

Manage Columns

Use the Manage Columns panel to create test data by adding columns. You can add, edit and delete columns on this panel.

To add a new column, enter the Column Name and then click Add.

You can also change the sequence of the columns through the drag & drop operation.

 

Edit/Delete Columns

To edit the column name, click on the cell and edit it.

To delete the column, hover over the column name. The Delete icon becomes visible; click on it.

On the test case detail screen, the column headings for the test data file will appear in accordance with what you have saved on the Manage Columns screen.

Add Properties to Columns

Once the columns are added, you can add properties to these test data columns.

Steps

1. Select the test data on the tree for which you want to add column properties.

You can see the added columns for the test data. The cells under the columns are editable.

2. Click in the cell and enter the property values.

The next row gets added automatically.

This way, you can add multiple columns and their properties for the test data.

Mask Test Data of a Column

You can mask the entire column data in the Test Data section.

Note: This would be only UI-level data masking.

1. Go to the Test Plan module.

2. Open the Test Data section.

3. Select the test data file on the tree.

4. Click on the Manage Columns button on the screen at the right.

5. Click on the mask icon for the column the data of which you want to mask.

The test data is masked.

To unmask the data of the column, click on the same icon.

Use Test Data

You can use the manually created test data or imported test data in the test cases. The following steps describe how the test data can be used in test cases.

1. Record a test case

You need to record the test case to construct a basic format of the test steps.

Record a test case as usually you do. For example, we are creating a test case Verify Login to link the Login Test Data to it.

You can see the input parameters contain the actual values you entered while recording the test case.

2. Link Test Data

To link a data set with the test case, click on the Link Dataset icon at the top.

A. Select Test Data

B. Data Driven Configurations

 

A. Select Test Data

Open the drop-down. It shows the folder structure of created test data. Expand the folder and select the test data you want to link with the test case.


B. Data Driven Configurations

You can make configurations to define how the data from the linked test data file will be used in the current test case. Select either of the following options as per your requirement.

Once you select the required option, click on the Link button at the bottom.

a) None: If you do not want to consider the test data for the test case, then select this option. The linked test data will be ignored and the test data will not be used while test execution.

b) Specific: If you want to use only specific rows of the test data in the current test case, then select this option. Mention the specific row number that is to be considered while test execution. You can mention multiple rows with comma-separated values.

c) Range: If you want to use only a selective range of rows from the linked test data, then use this option. The test data from the defined range will be used while the test execution.

d) All: Select the option to use all the data in the linked test data file while the test execution.

Once you select the required option, click on the Link button at the bottom.

 

On the test case screen, the linked test data name is displayed at the top in the place of Link Dataset icon.

You can also edit the association or change the data-driven configurations by clicking on the Edit Dataset icon.

To remove the association of test data with the test case, click on the Unlink Dataset icon.

3. Apply Test Data and Replace Input field values with placeholder

You need to replace the input field values on the grid with a placeholder in the format mentioned below.

Syntax of placeholder: ${column_name}

 

Steps

1. Open the test case recorded as mentioned in the Record Test Cases section above.

2. To edit the input value for the command, click on the Edit icon.

The Action Properties panel opens on the screen.

3. Click on the Edit icon for the input field.

As per the Login example cited in the previous sections, we have multiple combinations of Username and Password in the test data file.

There are two columns in the test data file: Username and Password.

For Command = "Type" and Locator name = "username", replace the input field values with ${username} placeholder 

For Command = "Type" and Locator name = "password", replace the input field values with ${password} placeholder 

4. Once you are done editing the input field value, click Update at the bottom of the panel.

Now you can see the input field values are replaced with placeholders.

4. Execute Test Case with Test Data

Execute the test case by clicking on the Dry Run button.

Select the Profile to run the test and click on the Dry Run button at the bottom.


The test will run multiple iterations in accordance with the properties entered in the test data file.

The test step will be executed for each value of the input field.

 

In Analytics, you can view the execution results for the test case.