Using Global Parameters for Automated Testing With Testsigma

DZone 's Guide to

Using Global Parameters for Automated Testing With Testsigma

Walk through this example to learn how to use global parameters in the Testsigma framework for test automation.

· DevOps Zone ·
Free Resource

In the programming domain, a global variable is a variable that has a global scope; it is visible and accessible throughout the program. Testsigma too provides a similar functionality through Global parameters. Global parameters in Testsigma have a scope that spans over an entire Project. All of the Test Suites and Test Cases created in the Project can use those parameters.

The use of Global Parameters in Testsigma also has an additional utility: security by obscurity. We can use Global parameters to conceal sensitive Test Data (login data) in Test Cases.

We need to do the following three steps to use Global parameters in Testsigma:

  1. Create a Global Parameter Set.

  2. Replace the test data with Global Parameter variable in a Test Step.

  3. Set the corresponding Global Parameter set while creating Execution.

Let us take an example of creating a Global Parameter Set with the login credentials for OrangeHRM Demo Website and using the same in Test Steps for logging into OrangeHRM Account.

1. Creating Global Parameter Set in Testsigma

You can access the Testsigma Test Automation tool after signing up for a free evaluation account at the Testsigma website.

A sample Project, a few Application Types, and Test Cases will be available by default.

Assuming you are logged into the Testsigma tool, Global parameters can be created/managed in Testsigma by going through Project Settings to Global parameters.

Once we are in the Global Parameters page, click on the Create button in the top right corner to get to the Create Global Parameter Set page.

Global Parameters Landing page

Enter a Global Parameter Set name and add the individual parameter name/names and parameter value/values in the table below it.

Below is an example of a Global Parameter Set populated with OrangeHRM website login credentials:

Image title

After entering the parameter data (parameter name-value pairs), click on Create to create the Parameter Set.

2. Using the Global Parameters in a Test Step

If you are new to Testsigma, please check out this article for more clarity on creating Test Cases and Test Steps.

Assuming you have gone through the above article, let us start:

Navigate to the Test Cases page by going through Select Project, to Select Application, to Select Version.

On the Test Cases page, click on + Test Case in the top right corner and create a Test Case with a suitable name such as "Global Parameter Usage Demo." On clicking the Create button, we will be taken to the Test Case details page.

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

To go to the OrangeHRM Website, 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 http://opensource.demo.orangehrmlive.com/ 

Image title

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

We need to type the username in the Username field now. Similar to step 4, start by entering "type" in the Action Textbox and select the template: type test data in ui identifier

We are going to use the previously created Global Parameter now. Double click on  test data  to select it and press the backspace key to remove it.

Image title

Select the *|Global| option from the suggestions and enter the name of the Global parameter that we created initially. We are going to use the already created OHRM_username parameter from 'Global Parameters Demo' Parameter Set.

Update the  ui identifier  by double-clicking on it and enter the UI Identifier name.

Please check the article on Testsigma KnowledgeBase for details on creating UI Identifiers.

Image title

We need to enter the password in the Password field now. We can use the same template used in step 6: type test data in ui identifier

Double click  test data, remove it and select *|Global| from the suggested list and then enter the name of the password parameter we want to use, i.e. OHRM_password.

Image title

Finally, we can click on the Login button. Start by entering "click" into the Action textbox and select the template click ui identifier 

Image title

Here's the complete list of Test Steps.

Image title

3. Setting the Global Parameter Set in Execution Settings

Let us create a Dry Run to execute the Test Case now. Click on the Run button in the top right corner to open the "Create Run" page.

Finally, enter a suitable name for the Execution and select the Global Parameter Set "OrangeHRM Credentials Demo" we created above, as shown here:

Image title

Click on Create and Run to execute the Test Case. We will be taken to the Test Results page where we can see the results and Test Reports.

That's all we need to create and use Global Parameters in Testsigma. You may check out Testsigma for more details.

testsigma ,devops ,tutorial ,automated testing ,test automation

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}