Using TypeIt4Me with Katalon Studio

In an previous article, I made comment of TypeIt4Me as a helpful tool to work alongside Katalon Studio. After several months, I have a full library of code snippets tucked away in TypeIt4Me, that allow me to put tests together much faster. In essence, I have automated parts of my automation code. TypeIt4Me is a text expander that allows me to type a single keyword and have it converted to a block of code. In most demos you see, the example is to type in something like “ttyl” which converts to Talk to you later. Or an “addr” abbreviation gets converted to: 1313 Mockingbird Ln Anywhere ST, 90210. These are fine examples, but code snippets are just as valid and save a huge amount of time. For example, I have the keyword replace@ set up as: tempText=tempText.replaceAll(“[\$,]”, “”) I can also type in for@ and get: for (loop = 1; loop <=10; loop++) {   println(loop) } The amount of […]

Recovering from Divide By 0 and Coming Back From Infinity with IsNaN and IsInfinite

While doing a series of regression tests, I noticed a few tests displayed errors due to a returned result of NaN. When I checked the test itself, it was for a margin calculation, and in some cases, one of the values was zero. This caused a divide by zero error, which returns NaN as a result. If this happens on the site, a 0.0% is displayed, but my test didn’t handle it correctly. There would be two ways to approach this. One is the detect zeros before doing a divide and set the result to 0. This forces the result to agree with the site. Another method is to use the isNaN function of Groovy. The calculation code stays the same, but the result is checked to see if it’s a number. For my situation, if the results is NaN, I set the answer to 0.0 to match the site result. My formula is the following: float calculatedMargin=(((Float.valueOf(GP) / Float.valueOf(sales)) […]

Checking for Page Load with a Custom Keyword

While looking through my code, I decided to set up a single validation test that would check to make sure the page I wanted to work with loaded correctly. Instead of repeatedly using 10-15 lines to do it a few different ways, it seemed the better choice would be to create a Custom Keyword and use one line of code to call it each time. To that end, I set up this simple, but rather effective Custom Keyword that looks for header text on the page I’m trying to get to. I set up the test to accept my chosen text as a parameter so I can pass it anything. For each page I go to, there is some sort of header text that identifies the page. It may say Profile or Customer or Sales, but there is something I can use for validation. I created the following Custom Keyword that simply looks for the header text I pass to […]

Setting up Environment Profiles in Katalon Studio

For those who just upgraded to the new Katalon Studio 5.4 version, you might have noticed the Global Variable button seems to be missing from the right hand side of the app. Actually, it’s been moved and improved and now Katalon supports “profiles” that allows you to set up and populate variables based on environment. From my previous example, this is where I would store the URL for the site I am working on. When I needed to change environments, I would manually edit my baseurl variable and everything would run fine. This has now been improved so you can define multiple sets of Global Variables for a profile and choose which one to work with. No more editing between test runs. My needs are fairly simple at the moment, as I only change baseurl for each test. However, I could add other variables or populate them with different information based on environment. It also saves me having to change […]

Securely storing passwords and login details with Set Encrypted Text in Katalon Studio

One of the new features for Katalon Studio 5.4 is the ability to store encrypted passwords right inside the test case using the Set Encrypted Text command. Previously, the username and password would be in clear text, so anyone who opened the file could see the login credentials. This now obscures that information while still allowing easy access. The new command is available while editing the script in Manual mode. Change the normal Set Text command to Set Encrypted text, which brings up a small dialog window that encrypts the text as you type. With the Item column now changed, double click the input field to bring up the encrypted text dialog box. On this new input screen, click the Value input field and you will be able to type in your text and see the encrypted text. This is what will be saved in the Test Case. For the login test I have, I check to see which environment […]