Sameer Kumar
← Blog

Testim - Automation testing on Steroids

4 min read

Artwork by Gaurav Singh

Testim is an AI-based testing framework that extends the concepts laid by traditional testing veterans like Selenium, Capybara, Jest, etc. Coming from a web development background, I understand the time and effort dedicated to writing and maintaining end-to-end tests. At times I saw engineers spending hours replicating user behavior through Selenium test scripts.

It was quite a simple interaction with UI elements in the browser, but writing test scripts using selectors was a different story, especially for someone from the development team. The biggest challenge that automated testing put in front of me as a developer was writing code for complicated navigations and UI interactions.

Last month, I started exploring solutions for the above problems and one day landed with testim.io. Testim not only automates the flow but also automates code generation for the test scripts. Let’s take a look together.


Getting Started

Testim has an intuitive onboarding process, but let’s go through them once for this article.


Time to get our hands dirty

Let’s go through each step with the help of some video clips and get a quick look at one of the many test approaches possible with Testim.

Goal

Tarka Labs (tarkalabs.com) has a fantastic website, and we want to see if the contact form there is working because what’s a company site without a contact form!

Let’s get things moving now, starting with creating a test folder, say “Contact.”

Testim test library with a Contact folder Testim test library

Creating a new test in Testim New Testim test

Video: Create Testim test Create Testim test [51 secs]

Starting a Testim test recording Testim test recording

Video: Record Testim test Record Testim test [1:13 min]

Video: Run Testim test Run Testim test [27 secs]

Video: Creating custom test on Testim.io using Javascript Creating custom test on Testim.io using Javascript [56 secs]


Let’s reflect

What we saw makes things simpler than ever but let’s not ignore the efforts it took to build such an awesome tool. Let’s get a glimpse of what’s happening behind the scenes. When Testim loads the test site, it roughly goes through these steps.

Test script generated by Testim.

"use strict";

import { test, l, Locator, go, resize, click, waitForText, type, sendCharacter } from 'testim';

Locator.set(require('./locators/locators.js'));

test("Submit web development form.", async () => {
  await go("https://tarkalabs.com/");
  await resize({width: 1395, height: 838});
  await click(l("+_menu"));
  await click(l("/Contact"));
  await waitForText(l("Build_new_product"), 'Build new product');
  await waitForText(l("Improve_existing_product"), 'Improve existing product');
  await waitForText(l("Training"), 'Training');
  await click(l("Build_new_product"));
  await click(l("Web_development"));
  await click(l("->"));
  await click(l("Name"));
  await type(l("Name"), 'Potato');
  await sendCharacter(l("Name"), '\t');
  await type(l("Email"), 'abc@def.com');
  await sendCharacter(l("Email"), '\t');
  await type(l("Phone"), '1243567890');
  await click(l("continue_->"));
  await click(l("About_the_project"));
  await type(l("About_the_project"), 'Something...');
  await click(l("[aria-hidden='false']_.footer_>_:nt"));
  await waitForText(l("Thank_you_for_all_your_details._We'"), 'Thank you for all your details. We\'ll contact you ASAP.');
});

Conclusion

Well, we have unraveled some powerful magic today. I can say one thing for sure; such tools will make the lives of engineers a lot easier and happier. Throughput from the testing team will increase, the test we did in this article would have taken a minimum of 30 mins to write using traditional methods, but we got it ready to roll within 30 seconds, perhaps. Such a paradigm shift will bring a tad bit of operational and skill challenges but is definitely a move in the right direction.

Muscular SpongeBob meme Already overflowing with power, eh!