An Introduction to Setting Up a Clean Testing Environment

In this mini-series (Netflix, are you listening?), Tom Shlaim, Automation Engineer at ironSource will walk you through the process of…

Author Avatar
By Tom Shlaim,

In this mini-series (Netflix, are you listening?), Tom Shlaim, Automation Engineer at ironSource will walk you through the process of building an environment for independent tests. For this journey, all that you will need is the desire to learn something new. Let’s get started!

In this introductory post, you will learn about the following:

  • The independent tests concept
  • Testim features:
    1. Test Plan
    2. API Action

What are independent tests?

Independent tests are tests that set up their own environment and do not depend on existing data. The tests’ environment is set up by API calls to the relevant platform’s services. The API calls generate the required entities and pass the responses’ params throughout the test. These params help serve us through our testing.

Why should I use independent tests?

Pros:

  • Maintainability – When working in an agile environment and dealing with a rapidly-growing product, it is much easier to implement changes to a relevant generic DTO (data transfer object) instead of maintaining multiple different entities, which should also be known across the team.Let’s take a new user flag as an example. The new user flag should be added to all the existing and new users. If you’re counting on existing data, you’ll need to add this new flag to all existing users.If you’re using independent tests, all you’ll need to do is to change the DTO’s properties in one place. And this is just a simple example.
  • Reusability – The independent tests environment and API calls can be shared and used across other tests.

Cons:

  • Time – It might take time to set up an entirely new data.

From my experience, the pros definitely outweigh the cons, but it’s up to your judgment. To make things clear, let’s examine a basic login test.
To login to the platform, we should have a registered user with an email and password in our platform’s database.

 

How can we achieve it?

  1. Use a registration form (UI)
  2. Use API calls
  3. Count on an existing user from the DB (Not an independent tests concept)

Both options one and two will serve the independent tests concept, as they don’t rely on existing data. In my opinion, option two is a better solution for two main reasons:

  1. Less time-consuming – Populating a UI form can take a long time.
  2. Easy to maintain – A UI form is changeable. We don’t want our login test to break because of a change to its appearance.

Starting to Get Practical

Before covering practical steps needed to create independent tests, you should understand the underlying concepts better. Let’s get introduced to the following Testim features:

Test Plan:


A test plan is an entity that allows you to unite several tests under the same plan. You can add a test that will run before the tests’ plan (yes, you’re in the right direction – we’ll use it to create our environment). You can also add a test that will run after the plan’s tests are finished (we will use it for teardown). Labels manage the entire logic.

Additional capabilities include:

  • Override default configuration – Set which browsers, operating systems, and resolutions to run your tests on.
  • Override Start URL – Set the start URL of your web application. For example, you can use it in order to differentiate between your production and staging environment.

Check out  Testim’s excellent documentation for more information and further reading.

API Action: 

The API action step allows you to send HTTP requests to your services within your tests (Get /Post/ Put/ Patch/ Delete/ Copy/ Head/Option). The response is stored in Testim’s param called: “responseBody”.

In the next few blog posts, we will execute generic API calls to the relevant services to create the entities in our platform, while exporting the relevant responses throughout the plan’s tests. To conclude, In this blog, we learned about the concept of independent tests. We became familiar with some basic Testim features which we will use in our next blog to learn practical steps to run independent tests and build an environment for a login test. 💪

About the Writer:
Tom Shlaim is an Automation Engineer at ironSource, a gametech company based in Israel. With a robust mobile ad mediation platform, mobile ad network, and a data-driven user acquisition platform, ironSource closes the monetization and marketing loop to empower game developers to turn their games into successful businesses. Tom’s AUT is a web platform that serves advertisers who want to promote their games across other games, by creating campaigns, analyzing data, etc. Feel free to stay connected on Linkedin

What to read next

What Is a Test Environment? A Guide to Managing Your Testing