Encrypted Values appearing as plain text when used as Stored Variable

Problem

If we wish to pass the encrypted value as a stored variable, the encrypted value is displayed as plain text in logs and results during execution. This scenario normally happens when you want to pass encrypted values from a workflow using stored variable to a reusable component as shown below. This is a common scenario when reusing Login component in different workflows where you need to use different User credentials for each workflow.

Step #

Component

Keyword

Object

Data

Step #

Component

Keyword

Object

Data

1

 

 

copyStringValueTo

 

String to Store : String1 (data type : Fixed Encrypted)
In variable : var
Left Boundary (Optional) :
Right Boundary (Optional) :

2

 

Component 1

setValue

username

Value : username (data type : Stored Variable)
Execution Mode (Optional) :

setValue

password

Value : var (data type : Stored Variable)
Execution Mode (Optional) :

3

Component 2

 

 

 

4

 

 

copyStringValueTo

 

String to Store : String2
In variable : var
Left Boundary (Optional) :
Right Boundary (Optional) :

 

5

 

Component 1

setValue

username

Value : username (data type : Stored Variable)
Execution Mode (Optional) :

setValue

password

Value : var (data type : Stored Variable)
Execution Mode (Optional) :

 

When you execute such test, the encrypted value is not displayed as plain text. This may not be the desired or expected behavior. There are two solutions to work through this constraint.

Solution 1 : Use values from Data table

If the workflow uses the Login component only once, then this solution works best.

  1. Break the workflow into multiple tests so that the particular component is used only once in the test.

  2. In the component use the encrypted value from Data table Encrypted



     

  3. Save the test & execute them.
    To execute the tests locally, in order to debug, do not forget to add launchApp keyword in the beginning (if not already added).

Result :

The encrypted values are displayed as encrypted.

 

 

Solution 2 : Use Dynamic Variable Substitution Mechanism using {{ }}

This is the most flexible method to pass and use values anywhere in the test. This works even if the same component is used multiple times in a single workflow with each usage of the component requiring different values.

Steps :

  1. Use copyStringValueTo to store the encrypted value into a variable
    For param 1 (String to store), select the data-type as Fixed Encrypted & enter the string to store.
    For param 2 (In Variable), enter the variable name ( Ex. var )

     

  2. Use setValue to use the value set in the variable in step 1 above.
    For param 1 (Value), select Fixed Encrypted as the data-type and enter variable name used in step 1 above within curly braces ( Ex. {{password}} )

     

  3. Save and Execute the test.

 

Result :

The encrypted values are displayed as encrypted.

 

 

Â