While Rainforest Step Variables were created with an intended purpose in mind (i.e. {{random.address_zip5}} was intended to produce a 5-digit zip US code), what step variables do in a practical sense is produce a value. Step variables in this regard can thus be used creatively to meet the needs of various situations.

String Variables to together to create longer character strings:

Besides the intended purpose of a given step variable, a common use case for step variables is stringing them together to create a longer character string. Virtually any two or more different step variables can be strung together to create a longer string. 

For example, {{random.address_zip5}} can be combined with {{random.first_name}} to produce something like "19345Alice". This compound variable value could be used in various situations, from identifying a dataset the tester is tasked with creating to writing out a random message that can be positively identified by the tester later on in the test. 

Using variables to create static unique email addresses:

There are some workflows that require a tester to have access to multiple email addresses to test completely. {{random.email}}, which is typically used to provide a tester with a randomly generated email, will provide only a single email. For workflows that require that 2 or more different email addresses, it is possible to create a second email for a tester's use by stringing together two or more step variables.

To define an email, two or more step variables can be combined together without spaces with an "@e.rainforestqa.com" like "{{random.last_name}}_{{random.password}}@e.rainforestqa.com" to produce something along the lines of "Rockman_y2ehSMZ6@e.rainforestqa.com". 

As this email is a e.rainforestqa.com domain email, to access this email simply define url like "e.rainforestqa.com/{{random.last_name}}{{random.password}}". Using the above example, the url to the inbox of "Rockman_y2ehSMZ6@e.rainforestqa.com" would be "e.rainforestqa.com/Rockman_y2ehSMZ6". 

Using variables for negative testing

Step variables can also be used to test whether the proper safeguards are in place to make sure that they're using your product as intended. Imagine that in a basic sign-up flow an end user must enter a password that is at least 6 characters long and must contain some special characters such as an underscore, or hash sign. Imagine also that a character string that doesn't match the criterion outlined above would cause a red warning message to appear below the password field. 

In this situation, to test out whether the warning properly triggers or not, one can instruct a tester to enter {{random.number}} (which produces a 9 digit numeric character string) and verify that the warning was triggered properly. Using a step variable provides a measure of confidence; while testers may be entering different values, there is a uniformity in the type of action they're taking. 

While these are common use cases for step variables, they're not the only ones. If you have a use case that you'd like to share or have questions regarding doing something, please feel free to let us know at support@rainforestqa.com!

Did this answer your question?