Skip to content

Incorporate System Variables into Conditional Logic

Before you read this you may want to see:

System Defined Variables:

 
“System Defined Variables” in Worksoft SaaS is designed to create the need for reuse of a single Test Case which differs in behavior and layout. Worksoft SaaS provides you to handle such behavior based on Testing Contexts (like different devices, browsers, browser versions, etc.), Environments and Automation Assets (Data Files, Scenarios & Run Definitions).

Example:   

 
Consider a scenario where you have to verify the product details on mobile devices and desktop. Assign the System Defined Variables in the script that will have to execute on mobile devices and desktop. The execution condition would be based on the Testing Context selected during the Test Run.

Steps To Configure System Variables:

  • Edit the test script for which System Variables have to be configured.
  • Click on "Add Instruction" icon, to add a conditional command (IF).
  • In the target, select “Add new locator”.
  • Click on the mouse symbol with 'S' icon (which gives you a provision to add System Variables)

  • Expand System variables by giving a click on the arrow mark beside it, so that the associated labels would get populated:

  • Select the condition which needs to be compared first. Here we have clicked on icon behind Texting Context 1st and selected Device Type 

  • Type the condition/operator (“==” or “!=”) beside the label in the text box.
  • Right-click on the same text box and Click the icon behind System variables
  • Access the icon behind Texting Context, Click the icon behind Device Type and then select the values that need to be compared from the populated results.

  • Click on save.
  • System Variable representation is shown below:

  • Add the commands which are to be executed in IF and ELSE block as per requirement.
  • Execute the Test Run.

Feedback and Knowledge Base