Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Functional Testing with Katalon Recorder

Parent Feed: 

When it comes to testing in software development, the range of options is huge. From unit testing on the backend through browser compatibility testing on the front end, there are a variety of testing approaches that will save you, your clients, and their audiences, time and headache. Katalon Recorder is a quick, simple way to get started with testing and to see the value that automated tests provide within a matter of minutes.

What is Katalon Recorder?

Katalon Recorder (KR) is a Selenium-driven browser plugin for Chrome and FireFox that lets you control your browser with simple commands instead of actual clicking, typing, tabbing, and scrolling. Put simply, KR can interact with your web application and report back when things don’t go as planned. Katalon Recorder aims to emulate human actions such as clicking, typing, and verifying the status of onscreen content - and as such works very well as an automated replacement for human testing.

How does it work?

With Katalon Recorder, you can record your browser actions - such as clicking through your menu items - and then play those actions back as automated commands. You can also handcraft a wide variety of commands that assert the existence of HTML elements or copy, among a host of other things. The successful playback of well crafted tests indicates that your menus, content, and HTML structure haven't changed — in other words your application is behaving as expected. Katalon Recorder

The Basics: Record and Playback

After clicking Record KR will bring your browser into focus, then log all of your interactions as individual commands. Once Stop is clicked, those commands can be played back, saved to a file, shared with others to play in their browsers, or modified to fine-tune functionality. With Katalon Recoder’s Record feature setting up initial tests that mirror human-driven clickthroughs takes moments of your time and can then be played back by anyone anywhere — including non-technical staff or even client teams. Katalon Recorder

Creating Complex, Rigorous Tests

Katalon Recorder allows you to organize one or more individual commands as Test Cases, and one or more Test Cases as Test Suites. Complicated tests can be created by chaining together several Test Suites. You could, for example, write tests that log a test user in, search for a product by SKU, click into the results, add the product to their cart, navigate to the cart and assert the product is there, then complete the purchase using test financial data. All of those actions except assert the product is in the cart can be recorded from your interactions. That means that in many cases, the amount of time that it takes for you to perform an action on your website is, using the recorder feature, the amount of time it takes you to write the automated test.

Flexibility Via Hand-Crafted Commands

In some cases the rigidity of recorded actions is a drawback. If, for example, you want to search for the tag Home Appliances and then click into the product Test Toaster, but you aren’t sure where in the search results that item will be, a recorded action informed by precise HTML structure might fall short. In those cases, you can use a combination of CSS and XPATH selectors to find and interact with your elements regardless of where exactly in the DOM they exist. Katalon Recorder

Storing Variables with Javascript

Sometimes a human tester needs to remember something, like the name or unique ID of a piece of content, in order to proceed with their test. Let’s say, for example, you’re testing a Drupal site wherein you first want to create a new Person node, then associate it via an entity reference field with a Group node on that node’s creation form. Using Katalon Recorder’s storeEval command you can use Javascript to accomplish that by saving a variable. Once you have saved the form for your Person node, you’ll get redirected to something like http://mysite.dev/node/887 where 887 is the node ID for your content. The storeEval command lets you save the ID number to a variable that we can access later in our tests. See the image below: Katalon Recorder Katalon Recorder covers a lot of bases. Whether you're using just the Record option for building basic spot-checks, or combining advanced features to create rigorous and complex functional testing, it's surprising what can be achieved in so little time — especially given KR's very tenable learning curve. While the examples above are exceedingly simple, in some recent projects we’ve combined thousands of commands across dozens of test cases that provide thorough regression testing and automated QA — and it all started with the click of a Record button.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web