Supercharge Your Quality Management with Katalon StudioAssist: A Comprehensive Guide to Optimizing Your Test Code
In the rapidly evolving field of software quality management, Katalon introduces a groundbreaking feature: Katalon StudioAssist. This innovative tool, powered by GPT (Generative Pretrained Transformer) technology, is designed to revolutionize how individual contributors interact with their existing test code.
Katalon StudioAssist leverages artificial intelligence to offer insightful explanations for your existing test code, making it easier than ever to understand, debug, and optimize. Additionally, it can generate new code snippets based on code contextual comments, a feature that will significantly enhance productivity and efficiency for developers and testers alike.
Katalon StudioAssist extends beyond mere code generation. It acts as a vital companion in your coding journey, providing real-time assistance and reducing the learning curve for those new to Katalon Studio. By simplifying complex coding tasks, Katalon StudioAssist empowers teams of any size to scale their testing capabilities and deliver high-quality software.
In this article we aim to share with you best practices, tips, and tricks to help you fully utilize it in your existing and new Katalon test scripts. Let’s dive in!
The first thing you need to do is create an OpenAI account to gain access to ChatGPT. There is no charge to use StudioAssist, and you may be incur charges based on your ChatGPT's subscription plan: ChatGPT Plus.
When the account is made you will also need to create an API key which can be accessed by clicking on your profile icon on the top left of your browser and selecting “view api keys.” From there you can create the secret API key and copy it. (Tip: Make sure to save this somewhere for reference later.) With the secret key in hand, you now need to launch Katalon Studio 9.0.0 (which you can download using the link below).
Now follow the selection from the screenshot below and paste your secret key into the text field and click “Apply.” The setup is complete and you can now use the StudioAssist feature in Katalon Studio.
2. Generate Code
Katalon has always been about enabling all users the ability to contribute towards testing with each user’s respected skill set. More users to generate test scripts means a faster and higher test coverage which means potential defects can be caught earlier in the sprint/cycle. That is why the StudioAssist “generate code” feature allows users to turn plain written text into lines of code for your scripts. So now anyone can write out a test script without automation or scripting knowledge.
This may seem like behavior-driven development (BDD) but because we are using a natural language processing tool like ChatGPT we are able to write out test using a more broad and flexible vocabulary.
So let’s go over an example. Please note that to use “generate code” feature you will need to have existing objects in your object repository from previous record and playback session. With that said, to start the example we need to be in the “script” view of any test cases in Katalon Studio (see red highlight in the screenshot below).
Once there, you need to create a comment (shown in screenshot above) and write out your test steps so that plain text doesn’t interfere with any compiling of the script. A key thing to remember is that the UI elements referenced in the text need to call out the objects by name in the object repository. The example below highlights a few keywords in the text and the objects they reference in the object repository. *Note* we referenced the text field by its object repo name “input_username” which is in the object repo folder “Page_home.” This is key when writing out a test script using the “generate code” feature of StudioAssist.
The only thing left to do is highlight a section of code and right click -> StudioAssist -> Generate Code.
Katalon will leverage OpenAI’s GPT model to translate the text into lines of code for your scripts. In the screenshot below you can see the generated code as well as each line of code accompanied by its respective line of text so that all users can clearly understand what each step in the test case is doing.
The generate code feature of StudioAssist, like many features within Katalon platform, enables users to leverage their respective skillset to create test cases in a timely manner and help collaborate with the many other types of users (automation engineers, developers, etc.).
3. Explain Code
Regardless of your technical skills it’s always easier to read plain text than lines of code. A best practice developers often use is their own documentation in the form of comments for any work that needs to be done so that the next user to contribute can easily interpret the script and quickly make any necessary changes. So it goes without saying that for an environment where business users collaborate with developers the ability to understand step(s) in a test case quickly will lead to faster test creation and maintenance.
In StudioAssist, you can do this by simply highlighting any section or line of code and right clicking on it and selecting StudioAssist -> Explain Code (screenshot below for reference).
The code is then translated into plain text where it is displayed below the highlighted section. Notice in the screenshot below that the explanation isn’t just a detailed step-by-step instruction but provides an overall explanation as well.
StudioAssist is now available in Katalon Studio 9.0.0, designed to help reduce and optimize the time it takes for test creation. With the use of ChatGPT, Katalon enables users to create tests through interpreting text, and provide a detailed explanation to existing and new scripts. These features will be further expanded upon and showcased in near future.