Skip to content

katalon-studio-samples/github-copilot-sample

Repository files navigation

GitHub Copilot Sample for Katalon Studio

This is a sample project demonstrating how to use GitHub Copilot effectively with Katalon Studio test automation projects.

Configuring GitHub Copilot in Katalon Studio

Katalon Studio supports GitHub Copilot through its built-in integration. Follow these steps to configure it:

Prerequisites

  1. GitHub Copilot subscription - You need an active GitHub Copilot subscription (Individual, Business, or Enterprise)
  2. Katalon Studio 10.4.0 or later with GitHub Copilot support - GitHub Copilot support is still in preview, so ensure you have the latest version of Katalon Studio

Configuration Steps

Initial Setup

When you first start Katalon Studio with GitHub Copilot integration, you may see a quick start screen. You can close this window by clicking the X in the upper right corner.

Copilot Quick Start Screen

You may also see release notes for the current Copilot release:

Copilot Release Notes

In the lower left corner of the main project window, you should see a Copilot icon (a sparkle or star symbol). Clicking on this icon gives you access to all Copilot features:

Copilot Menu Icon

Authenticating with GitHub

  1. Sign in to GitHub

    • Click on the Copilot icon in the lower left corner
    • Select "Sign in to GitHub" from the menu

    Sign in to GitHub

  2. Device Activation

    • A dialog will appear with a device code
    • Click "Copy Code and Open" to copy the code and open your browser to GitHub's device activation page

    Device Code Dialog

  3. GitHub Authentication Flow

    • Your browser will open to GitHub's device activation page

    GitHub Device Activation

    • Paste the activation code when prompted

    Enter Activation Code

    • Click Continue and then Authorize to grant Katalon Studio access to GitHub Copilot

    Authorize Access

  4. Verify Connection

    • Once authorized, you should see a confirmation screen on GitHub

    GitHub Confirmation

    • In Katalon Studio, you'll see confirmation that you're signed in

    Katalon Studio Signed In

Using the Copilot Menu

The Copilot menu in the lower left corner provides access to:

  • Open Chat - Opens the Copilot Chat window
  • Sign in/Sign out - Manage your GitHub authentication
  • Edit Preferences - Configure MCP (Model Context Protocol) servers
  • Help and documentation - Access Copilot resources

Using GitHub Copilot in Scripts

Once configured, GitHub Copilot will:

  • Provide inline code suggestions as you type in the Script Editor
  • Suggest complete functions and test steps based on comments
  • Autocomplete Katalon keywords and custom methods
  • Generate test automation code following Katalon best practices

Keyboard Shortcuts:

  • Accept suggestion: Tab
  • Dismiss suggestion: Esc
  • Show next suggestion: Alt + ] (Windows/Linux) or Option + ] (macOS)
  • Show previous suggestion: Alt + [ (Windows/Linux) or Option + [ (macOS)

Copilot Chat

GitHub Copilot includes a chat interface for interactive assistance:

  1. Opening Chat

    • Click the Copilot icon in the lower left corner
    • Select "Open Chat"

    Open Chat Menu

    • The chat window will open alongside Studio's Console, Log Viewer, etc.

    Chat Window

  2. Using Chat

    • Ask questions about your code, Katalon best practices, or test automation
    • Get explanations of existing code
    • Request code generation with specific requirements
    • The chat window can be relocated by dragging and dropping

    Relocated Chat Window

Agent Mode

Agent mode is an advanced feature that autonomously translates your intent into code:

  • What it does: Analyzes your project, breaks down requests into actionable steps, and executes changes across multiple files
  • How to use: Simply provide a prompt describing what you want to accomplish
  • Benefits: Handles complex, multi-file changes automatically
  • Example: "Create a new test suite for login scenarios with data-driven testing"

Model Context Protocol (MCP)

You can configure MCP servers for extended functionality:

  1. Click the Copilot icon and select "Edit Preferences..."

  2. Or click the tools icon in the lower right of the chat window

    MCP Preferences

  3. Configure MCP servers using standard syntax

  4. Enable/disable specific servers and tools

  5. Access MCP registries for additional integrations

    MCP Configuration Dialog

Understanding copilot-instructions.md

The .github/copilot-instructions.md file is a repository-scoped instruction file that provides GitHub Copilot with specialized knowledge about Katalon Studio projects.

What is copilot-instructions.md?

GitHub Copilot supports custom instruction files that give the AI assistant context-specific guidance. When you work in a repository containing this file, Copilot automatically uses the instructions to generate more accurate, project-appropriate suggestions.

How It Works

The file located at .github/copilot-instructions.md contains:

  1. Project Structure Documentation

    • Explains the standard Katalon Studio directory layout
    • Describes what each folder contains (Test Cases/, Scripts/, Keywords/, etc.)
  2. File Format Specifications

    • Details the XML schemas for test cases, test suites, test objects, and profiles
    • Explains the relationship between test case metadata and Groovy scripts
    • Provides examples of proper file structure
  3. Best Practices

    • Katalon-specific coding conventions
    • Proper use of built-in keywords (WebUI, WS, Mobile)
    • Data-driven testing patterns
    • Security considerations (avoiding hardcoded credentials)
  4. Domain-Specific Guidance

    • API testing patterns
    • Web UI automation approaches
    • BDD/Cucumber integration
    • Custom keyword development

Benefits of Using copilot-instructions.md

When Copilot has access to these instructions, it can:

  • Generate compliant code: Suggestions follow Katalon's file structure and XML schemas
  • Use correct APIs: Copilot knows the proper Katalon keyword syntax and imports
  • Follow conventions: Generated code matches your project's patterns (static imports, relative paths, etc.)
  • Avoid anti-patterns: Instructions warn against common mistakes like hardcoded credentials or fixed delays
  • Understand context: Copilot knows how test cases, scripts, and object repositories relate to each other

Example Impact

Without instructions, Copilot might suggest:

// May not follow Katalon conventions
driver.findElement(By.xpath("//button")).click()

With instructions, Copilot suggests:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.click(findTestObject('Page/Submit_Button'))

Maintaining the Instructions File

The copilot-instructions.md file should be:

  • Version controlled: Committed to the repository so all team members benefit
  • Updated regularly: Modified when project conventions change or new patterns emerge
  • Project-specific: Customized to reflect your team's standards and practices

You can extend the existing file with:

  • Custom keyword documentation
  • Project-specific test data patterns
  • Team coding standards
  • Integration with CI/CD pipelines

Getting Started

  1. Clone this repository or use it as a template
  2. Configure GitHub Copilot in Katalon Studio (see steps above)
  3. Open any script file in the Scripts/ folder or create a new test case
  4. Start typing and observe how Copilot suggestions follow Katalon best practices
  5. Experiment with comments like // Navigate to login page and enter credentials to see Copilot generate complete test steps

Additional Resources

Contributing

If you discover patterns or best practices that should be added to copilot-instructions.md, please submit a pull request with:

  • Clear description of the pattern or practice
  • Example code demonstrating the recommendation
  • Rationale for why it improves code quality or maintainability

About

Template project for use with Github Copilot for Katalon Studio

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published