Managing data in Automated Tests can be quite tricky sometimes. You might need to use the same value several times or you might need a new value for each run.

The variable’s name represents what information the variable contains. They are called variables because the represented information can change but the operations on the variable remain the same.

For example, let’s say that you have a test case that checks for hotel bookings in Chicago. You’re probably going to have to add the ‘Chicago’ value in 4–5 steps. After some time, you might need to update that test case to check for hotel bookings in Boston. Looking for all the steps where you’ve added the ‘Chicago’ value might be a bit time-consuming.

Another example would be a test case that checks the Sign Up section, you won’t be able to use the same hardcoded email value over and over again.

Using variables in Endtest is easy and intuitive. You just have to select the ‘Set Variable’ option from the ‘Action’ dropdown, pick a name for your variable and select the type.

Variable Types in Endtest:

1. Set value

This is the most basic option, you just provide the value for your variable and then you can directly start using that variable in your test cases.

2. Set password

This option provides a way for the user to securely enter a password in a test.

It can be very useful if you’re sharing your test suite with other users from your organisation.

Some applications might require passwords and sharing credentials is never a good idea.

3. Random Number

There are situations where you might need to enter a phone number or a Social Security number (SSN). Entering the same value in each test run might lead up to validation errors.

In order to control the randomness, you just have to enter the length of the number.

4. Random String

Similar to the ‘Random Number’ option, there are situations where you might need to enter a random string in your tests.

5. Random Email

Definitely one of the most useful options, I use it whenever I need to provide a unique email address for a Sign Up form in my tests.

And since you don’t want your emails flying all over random domains, you just have to provide the Email Domain.

6. Timestamp

There are some situations where the data you enter in your tests needs to reflect the time in which that step was executed.

You can choose from several timestamp formats.

7. Extract value from element

The ‘Set Variable’ action not only allows you to enter and generate values, it also allows you to extract values from the elements in your Web Application.

8. Extract value from JS variable

I have encountered a few situations where this option was very useful, especially for assertions.

But what happens when you need to create or generate a complex variable which is made up of different strings and numbers?

Variable concatenation is the answer.

To concatenate variables, just add a + sign between them.

Since I’ve added this screenshot with concatenating a URL, you might wonder how you can run your test on different environments without updating the URL variables each and every time.

The answer to this problem would be to add the variables directly in the API call for starting a test run. As you’ll notice in their Documentation section, you can easily provide up to 3 variables in the API call.

Also, here’s a video tutorial about using variables that I found on their YouTube channel.