Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Handling Runtime Test Data for Automation Testing Using Testsigma

DZone's Guide to

Handling Runtime Test Data for Automation Testing Using Testsigma

Learn how you can use Data-Driven Testing to obtain and use data during test execution with Testsigma in this tutorial.

· DevOps Zone ·
Free Resource

Planning to extract out a few microservices from your monolith? Read this free guide to learn the best practice before you get started.

Introduction - Runtime Test Data

In Data-driven Testing, we keep the Test Data separate from Test Cases to meet maintainability and security concerns for test scenarios that depend on a lot of external data. This is achieved with the use of test data profiles (the equivalent of external data stores such as JSON or CSV files).

We have talked about regular Data Driven Testing using Testsigma in a previous article.

But what if we need to get data at runtime, i.e. during test execution? That is, what if we need to get data from the result of a previous test step and use it in the current test step? This is where the Runtime Test Data feature comes handy.

Runtime Test Data is used to store data obtained during runtime, i.e. during the execution of test cases, for use in a test step that comes later.

Using Runtime Test Data in Testsigma

The ability to fetch test data at runtime increases the robustness and flexibility of Tests. For example, the title of a webpage can be checked before and after an operation is carried out on the page (for example, page reload) using a runtime data check.

Let us take the example of the Google homepage in this case. We will be examining the page title of the Google homepage before and after a page refresh. Let us see how it's done. If you are new to Testsigma, please check out this article for more clarity on creating test steps:

Assuming you have gone through the article on automated web app testing, let us start:

  1. After logging into your Testsigma account, navigate to the test cases page by going through Select Project > Select Application > Select Version.

  2. On the Test Cases page, create a test case with a suitable name using the "+ Test Case" button in the top right corner. We will be taken to the Test Case details page.

  3. Click on the Create Test Steps button to open the Create Test Step wizard.

  4. Start by entering "go" in the Action Textbox to get the suggestions as shown below. Select the template: go to test data  and replace test data with https://www.google.com.

    Image title

  5. Click on the Create and Continue button to save the current step and create the next step in a single click. The Test Step wizard starts a new instance and we can create the second step now.

  6. Similar to the step 4, start by entering "store" in the Action Textbox and select the template store title of the current page into a variable test data

  7. Replace test data with a variable name, such as pagetitle, and create the step.

    Image title

  8. Enter "refresh" into the Action Textbox and select the template Click the Refresh button in the browser

    Image title

  9. Finally, verify the actual page title with page title stored in the variable pagetitle using the template The page title should be test data

  10. We are going to use the stored Runtime variable now. Double-click on test data to select it and press the backspace key to delete it. You can see the test data suggestions as shown below:

    Image title

  11. Select the $|Runtime| parameter and enter the name of the variable where we store the page title, i.e. pagetitle.

We have successfully created a test case that verifies the title of the Google homepage using runtime test data.

Here's the complete list of test steps:

Image title

That's all we need to use runtime test data using Testsigma.

Welcome to the era of #SmartTestAutomation with Testsigma!

Learn how to measure the impact of every feature release on performance and customer experience metrics.

Topics:
testsigma ,data driven testing ,test automation ,automated testing ,tutorial ,devops

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}