Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 21, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 21, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 21, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 21, 2025

      Google DeepMind’s CEO says Gemini’s upgrades could lead to AGI — but he still thinks society isn’t “ready for it”

      May 21, 2025

      Windows 11 is getting AI Actions in File Explorer — here’s how to try them right now

      May 21, 2025

      Is The Alters on Game Pass?

      May 21, 2025

      I asked Copilot’s AI to predict the outcome of the Europa League final, and now I’m just sad

      May 21, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Celebrating GAAD by Committing to Universal Design: Equitable Use

      May 21, 2025
      Recent

      Celebrating GAAD by Committing to Universal Design: Equitable Use

      May 21, 2025

      GAAD and Universal Design in Healthcare – A Deeper Look

      May 21, 2025

      GAAD and Universal Design in Pharmacy – A Deeper Look

      May 21, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Google DeepMind’s CEO says Gemini’s upgrades could lead to AGI — but he still thinks society isn’t “ready for it”

      May 21, 2025
      Recent

      Google DeepMind’s CEO says Gemini’s upgrades could lead to AGI — but he still thinks society isn’t “ready for it”

      May 21, 2025

      Windows 11 is getting AI Actions in File Explorer — here’s how to try them right now

      May 21, 2025

      Is The Alters on Game Pass?

      May 21, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Choosing Between callTestCase and Custom Keywords in Katalon Studio

    Choosing Between callTestCase and Custom Keywords in Katalon Studio

    August 21, 2024

    Understanding the differences between using callTestCase and custom keywords in Katalon Studio is crucial for effective test automation. Both methods serve the purpose of code reuse, but they have distinct applications, advantages, and limitations. This blog will explore these differences, helping you decide when to use each approach and which one might be better suited for your needs.

    What is callTestCase?

    The callTestCase method allows one test case to invoke another test case within Katalon Studio. This is particularly useful for organizing tests into modular components, where a test case can serve as a helper for multiple other test cases.

    // Main Test Case

    import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

    // Call another test case

    WebUI.callTestCase(findTestCase(‘Login Tests/Valid Login’),

                        [(‘username’) : ‘testUser’, (‘password’) : ‘testPass’],

                        FailureHandling.STOP_ON_FAILURE)

    Advantages of Using callTestCase:

    Modularity: By breaking down complex test scenarios into simpler, reusable test cases, you can improve the maintainability of your test suite.
    Ease of Use: Test cases called with callTestCase can be easily managed and viewed in the Test Explorer, making it straightforward for testers to understand the test flow.
    Parameter Passing: You can pass parameters to the called test case, allowing for dynamic behavior based on different inputs.
    Logging: Each test case execution is logged separately, providing detailed insights into the execution flow.

    Limitations of Using callTestCase:

    Performance: Calling multiple test cases can lead to slower execution times due to the overhead of managing separate test case logs and execution contexts.
    Verbosity: The execution logs can become verbose, which may complicate debugging and make it harder to identify issues.

    What are Custom Keywords?

    Custom keywords are reusable functions that you can define in Katalon Studio. They are typically created to encapsulate common actions that can be reused across multiple test cases. Custom keywords are defined in the Keywords folder and can be annotated with @Keyword to make them available in both manual and script modes.

    // Custom Keyword Definition

    import com.kms.katalon.core.annotation.Keyword

    import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

    class LoginKeywords {

        @Keyword

        def login(String username, String password) {

            WebUI.setText(findTestObject(‘Page_Login/input_Username’), username)

            WebUI.setText(findTestObject(‘Page_Login/input_Password’), password)

            WebUI.click(findTestObject(‘Page_Login/button_Login’))

        }

    }

    // Using the Custom Keyword in a Test Case

    import myKeywords.LoginKeywords as Login

    Login.login(‘testUser’, ‘testPass’)

    Advantages of Using Custom Keywords:

    Performance: Custom keywords run faster than calling test cases because they do not generate extensive execution logs for each step. This can lead to improved performance, especially for frequently used actions.
    Simplicity: Custom keywords can simplify complex test logic by encapsulating it in a single function, making your test cases cleaner and easier to read.
    Flexibility: Keywords can be designed to accept parameters and return values, allowing for dynamic and reusable code.
    Less Verbose Logging: Since custom keywords do not log every step like test cases do, they help keep logs concise and focused on critical information.

    Limitations of Using Custom Keywords:

    Limited Context: Custom keywords do not have their own execution context like test cases do. This means they cannot manage their own setup and teardown processes.
    Manual Mode Limitations: If you want to use custom keywords in manual mode, they must be annotated with @Keyword, which may not be necessary if you primarily use script mode.

    When to Use Each Approach

    Use callTestCase When:

    You need to execute a complete test case that includes setup and teardown logic.
    You want to maintain detailed logs for each test case execution to facilitate debugging.
    You are working on a modular test design where each test case represents a distinct functional area.

    Use Custom Keywords When:

    You have repetitive code that needs to be reused across multiple test cases without the overhead of separate execution logs.
    Performance is a concern, and you want to minimize execution time.
    You need to encapsulate complex logic that can be reused in a straightforward manner.

    Conclusion

    The choice between callTestCase and custom keywords largely depends on your specific testing needs and the structure of your test suite. If you prioritize modularity and detailed logging, callTestCase is the way to go. However, if you are focused on performance and code reuse without the verbosity of test case logs, custom keywords are the better option.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleExploring Common Exceptions and their Workarounds in Katalon Studio
    Next Article Building a Retrieval-Augmented Generation (RAG) App

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 22, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4094 – “Acunetix DIGITS WordPress OTP Brute Force Vulnerability”

    May 22, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Read graphs, diagrams, tables, and scanned pages using multimodal prompts in Amazon Bedrock

    Development
    5 things the Surface Pro 12 needs to finally beat the Apple iPad Pro in 2025

    5 things the Surface Pro 12 needs to finally beat the Apple iPad Pro in 2025

    News & Updates

    Developer Spotlight: Quentin Hocdé

    News & Updates

    CVE-2025-24344 – CtrlX OS Cross-Site Scripting (XSS)

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    Development

    This AI Paper Propose SHARQ: An Efficient AI Framework for Quantifying Element Contributions in Association Rule Mining

    January 1, 2025

    Data mining is vital for uncovering meaningful patterns and relationships within large datasets. These insights…

    Smashing Security podcast #394: Digital arrest scams and stream-jacking

    November 21, 2024

    My Journey to Stunning Videos: Unleashing Creativity with FlexClip Video Editing Software

    June 21, 2024

    CVE-2025-3223 – GE Vernova WorkstationST Path Traversal Vulnerability

    May 19, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.