Pricing
TABLE OF CONTENTS

Mastering StudioAssist: Efficient Mobile, API, and Web Testing

Introduction

As a software testing professional, you know the importance of efficient and reliable testing processes. With Katalon's StudioAssist, you can streamline your testing workflow and ensure high-quality results. In this comprehensive guide, you'll learn how to utilize StudioAssist for mobile, API, and web testing through practical examples and step-by-step instructions. Whether you're a seasoned tester or just starting out, this guide will help you harness the full potential of StudioAssist.

Mobile Testing: Writing a mobile test script and playback with TestCloud

Testing mobile applications can be challenging, but StudioAssist makes it simpler and more efficient. Let's dive into how you can write a mobile test script and play it back using TestCloud.

1. Prerequisite

Some mobile test objects are in the Studio object repo. However,  you can quickly capture test objects using mobile object spy, see Spy mobile utility

2. Step-by-Step Guide

Step 0: Getting Things Ready

Step 1: Prepare the Prompt

To write this prompt effectively, we will need to prepare the list of manual test steps, and the list of test object that you will use. You can use the Mobile Object Spy to quickly capture and prepare this test object. Make sure that you mention the type of test case you want to generate test, eg mobile test case, and specify the application under test in your prompt.

/* Write a mobile test case with the following steps:
 * 1. Start application, uninstalling the application automatically after run
 * 2. Tap on the linear layout, timeout 0
 * 3. Get text 'HorizontalNestedScrollView', timeout 0
 * 4. Close the app
 * My app ID: 6261b88f-275b-4ae5-b0d1-b95fbf2560bd
 * Object list:
 * findTestObject('Object Repository/android.widget.LinearLayout')
 * findTestObject('Object Repository/android.widget.TextView - HorizontalNestedScrollView')
 */

 

Step 2: Generate the Code

Highlight the prompt, right-click, and choose StudioAssist > Generate Code. StudioAssist will generate the test case code for you. Here is what it returned:

// Start application and uninstall automatically after run
Mobile.startApplication('6261b88f-275b-4ae5-b0d1-b95fbf2560bd', true)
// Tap on the linear layout with timeout 0
Mobile.tap(findTestObject('Object Repository/android.widget.LinearLayout'), 0)
// Get text 'HorizontalNestedScrollView' with timeout 0
String text = Mobile.getText(findTestObject('Object Repository/android.widget.TextView - HorizontalNestedScrollView'), 0)
// Close the app
Mobile.closeApplication()
 

 

Step 3: Playback with TestCloud

Once the code is generated, you can playback the test case using TestCloud devices to see if it passes.

API Testing: Verifying status code

API testing is crucial for ensuring your services perform as expected. StudioAssist simplifies the process. Let's look at how you can verify the status code of an API response.

1. Prerequisite

Ensure you have a web service request in the object repository. You can quickly import an API specification and convert it into Studio web service requests. For more details, see Import REST request from OpenAPI.

2. Step-by-Step Guide:

Step 1: Prepare the Prompt

Write the following prompt to create an API test case:

/* Write an API test case to verify status code
 * Step 1: Send a request and returns its response
 * Step 2: Verify if the response from the object returns the 200 status code'
 * Object ID: findTestObject('Object Repository/GET user by id')
 */

Tip: Drag and drop the objects to the script editor or right-click and copy a test object ID.

 

Step 2: Generate the Code

Highlight the prompt, right-click, and choose StudioAssist > Generate Code. StudioAssist will generate the test case code for you.

// Send a request and returns its response
def response = WS.sendRequest(findTestObject('Object Repository/GET user by id'))
// Verify if the response from the object returns the 200 status code
WS.verifyResponseStatusCode(response, 200)

 

Step 3: Playback the Test Case

Run the generated test case to verify if it passes.

 

Web Testing: Generating a login test script using existing test objects

Web testing is an integral part of any testing strategy. StudioAssist can help you generate test scripts for web applications quickly and efficiently. Here are the steps:

Step-by-Step Guide:

Step 1: Prepare the Prompt

Go to the Script tab and describe the scenario you want to test in plain language. For example:

/* Generate a login test script using existing test objects
 * Step 1: Open the login page
 * Step 2: Enter the username
 * Step 3: Enter the password
 * Step 4: Click the login button
 */
 

 

Prepare the StudioAssist prompt by describing the scenario you want to test in plain language

 

Step 2: Highlight the prompt text

Highlight the prompt text in StudioAssist

 

Step 3: Generate the code

Trigger StudioAssist to generate code from your prompt. Right-click and select StudioAssist > Generate Code or use hotkeys Ctrl + Shift + C for Windows or ^ + ⌥ + C for macOS.

Trigger StudioAssist to generate code from your prompt

 

Step 4: Review the generated script. 

The generated test script will populate right below the prompt.

Generate basic test script in StudioAssist

 

Step 5: Execute the test script to ensure it works as expected.

Execute the StudioAssist test script to ensure it works as expected

You May Be Interested In:

  1. Master StudioAssist: A quick guide to summarizing and explaining code in Katalon Studio
  2. Mastering StudioAssist: Your Essential Guide to Data-Driven Testing and Reusing AI-Generated Test Cases

Conclusion

StudioAssist is a powerful tool that can significantly enhance your testing efficiency across mobile, API, and web platforms. By following these step-by-step guides, you can quickly generate and execute test scripts, ensuring your applications perform flawlessly. Start leveraging StudioAssist today and take your testing capabilities to the next level.

Ready to optimize your testing workflow? Get started with StudioAssist today and see the difference it can make in your testing process! 

banner9.png