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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 15, 2025

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

      May 15, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 15, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 15, 2025

      Intel’s latest Arc graphics driver is ready for DOOM: The Dark Ages, launching for Premium Edition owners on PC today

      May 15, 2025

      NVIDIA’s drivers are causing big problems for DOOM: The Dark Ages, but some fixes are available

      May 15, 2025

      Capcom breaks all-time profit records with 10% income growth after Monster Hunter Wilds sold over 10 million copies in a month

      May 15, 2025

      Microsoft plans to lay off 3% of its workforce, reportedly targeting management cuts as it changes to fit a “dynamic marketplace”

      May 15, 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

      A cross-platform Markdown note-taking application

      May 15, 2025
      Recent

      A cross-platform Markdown note-taking application

      May 15, 2025

      AI Assistant Demo & Tips for Enterprise Projects

      May 15, 2025

      Celebrating Global Accessibility Awareness Day (GAAD)

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

      Intel’s latest Arc graphics driver is ready for DOOM: The Dark Ages, launching for Premium Edition owners on PC today

      May 15, 2025
      Recent

      Intel’s latest Arc graphics driver is ready for DOOM: The Dark Ages, launching for Premium Edition owners on PC today

      May 15, 2025

      NVIDIA’s drivers are causing big problems for DOOM: The Dark Ages, but some fixes are available

      May 15, 2025

      Capcom breaks all-time profit records with 10% income growth after Monster Hunter Wilds sold over 10 million copies in a month

      May 15, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Guide to Using KeywordLogger in Katalon Studio

    Guide to Using KeywordLogger in Katalon Studio

    June 10, 2024

    Logging is an essential part of test automation. It helps you keep track of what your tests are doing, spot errors, and understand why certain steps were skipped. In Katalon Studio, KeywordLogger is a handy tool that makes logging easy and effective. This guide will show you how to use KeywordLogger with simple examples.

    What is KeywordLogger?

    KeywordLogger is a feature in Katalon Studio that lets you log different types of messages. These messages can be:

    Informational: To tell you what’s happening in your test.
    Errors: To alert you when something goes wrong.
    Skipped: To indicate when a step is skipped.

     

    Basic Usage

    First, you need to create a logger object and then use its methods to log messages. Here’s a simple example:

    KeywordLogger logger = new KeywordLogger()

    logger.logInfo(“This is an info message”)

    logger.logError(“This is an error message”)

    logger.logSkipped(“This is a skipped message”)

    Console Output

    Breaking Down the Example

    Import KeywordLogger: You need to include KeywordLogger in your script.
    Create a logger: KeywordLogger logger = new KeywordLogger()
    Log messages: Use logInfo, logError, and logSkipped methods.

     

    Practical Examples

    Logging Informational Messages

    Use logInfo to track the flow of your test.

    Example: Start and End of a Test Case

    import com.kms.katalon.core.logging.KeywordLogger

    KeywordLogger logger = new KeywordLogger()

    logger.logInfo(“Starting the test case: Verify Login”)

    // Simulate login test steps

    try {

        performLogin(“username”, “password”)

        logger.logInfo(“Login successful”)

    } catch (Exception e) {

        logger.logError(“Login failed: ” + e.message)

    }

    logger.logInfo(“Ending the test case: Verify Login”)

     

    Logging Errors

    Use logError to capture any issues that occur.

     

    Example: Form Submission Error

    import com.kms.katalon.core.logging.KeywordLogger

    KeywordLogger logger = new KeywordLogger()

    try {

        submitForm(“formData”)

        logger.logInfo(“Form submitted successfully”)

    } catch (Exception e) {

        logger.logError(“Form submission failed: ” + e.message)

    }

     

    Logging Skipped Steps

    Use logSkipped to note when a test step is conditionally skipped.

     

    Example: Skipping Based on a Condition

    import com.kms.katalon.core.logging.KeywordLogger

    KeywordLogger logger = new KeywordLogger()

    boolean isFeatureEnabled = checkFeatureToggle(“newFeature”)

    if (isFeatureEnabled) {

        try {

            testNewFeature()

            logger.logInfo(“New feature test executed”)

        } catch (Exception e) {

            logger.logError(“New feature test failed: ” + e.message)

        }

    } else {

        logger.logSkipped(“New feature is disabled, test skipped”)

    }

     

    Advanced Usage: Test Listeners

    Test Listeners in Katalon Studio allow you to log messages automatically at different stages of your test lifecycle, such as before a test case starts and after it ends.

    Example: Using Test Listeners

    import com.kms.katalon.core.logging.KeywordLogger 

    import com.kms.katalon.core.annotation.BeforeTestCase 

    import com.kms.katalon.core.annotation.AfterTestCase 

    import com.kms.katalon.core.context.TestCaseContext

    @BeforeTestCase

    def beforeTestCase(TestCaseContext testCaseContext) {

     KeywordLogger logger = new KeywordLogger()

       logger.logInfo(“Starting test case: ” + testCaseContext.getTestCaseId())

     }

    @AfterTestCase

     def afterTestCase(TestCaseContext testCaseContext) {

      KeywordLogger logger = new KeywordLogger()

     logger.logInfo(“Completed test case: ” + testCaseContext.getTestCaseId())

     }

     

    Output

    Conclusion

    Using KeywordLogger in Katalon Studio is straightforward and highly beneficial for tracking your tests, spotting errors, and understanding skipped steps. By following the examples in this guide, you can easily incorporate logging into your test scripts, making them more robust and easier to debug.

    Source: Read More 

    Hostinger
    Facebook Twitter Reddit Email Copy Link
    Previous ArticleIntegrating KeywordLogger with Test Listeners in Katalon Studio
    Next Article How to compose JavaScript functions that take multiple parameters (the epic guide)

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 16, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4732 – TOTOLINK A3002R/A3002RU HTTP POST Request Handler Buffer Overflow

    May 16, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    Getting Started with 2D Physics in Godot [FREE]

    Development

    Effortless Scheduling in Linux: Mastering the at Command for Task Automation

    Learning Resources

    The best Galaxy Z Flip 6 cases of 2024

    Development

    How Scientific Machine Learning is Revolutionizing Research and Discovery

    Development

    Highlights

    How safe is OpenAI’s GPT-4o? Here are the scores for privacy, copyright infringement, and more

    August 9, 2024

    The AI giant’s latest System Card tracks performance across key categories like cybersecurity, model autonomy,…

    Under lock and key: Protecting corporate data from cyberthreats in 2025

    January 22, 2025

    Compare images with theTwentyTwenty component for Vue.js

    January 9, 2025

    Kingdom Come: Deliverance 2 preorder guide — Bonus, Collector’s Edition, and where to buy

    January 30, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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