RobotCode Documentation

website·Indexed 32 days ago

https://robotcode.io

A set of tools, extensions, and plugins designed to enhance the development experience with Robot Framework. It includes a Command Line Interface (CLI) for static code analysis via `robotcode analyze code` and run result analysis via `robotcode results`, as well as support for AI coding agents and configuration through the `robot.toml` file.

Tokens
67.3K
Snippets
431
Records
519
Agent score
63%

What's inside RobotCode

  1. Overview of RobotCode test wrappers

    The wrapper option allows you to run RobotCode commands (like run, debug, repl, robot, run-debug, and repl-server) through a custom command of your choosing. RobotCode appends its own command line to the end of the wrapper command. This is used to set up environments—such as starting a database, a message broker, or a virtual X server—and tearing them down after the tests finish.

    Note: If you only need to set environment variables, use the [env] section in robot.toml instead of a wrapper.

  2. Overview of RobotCode AI Agent integration

    RobotCode bridges the gap between AI coding agents and Robot Framework projects. Instead of the agent guessing project wiring (suites, tags, keywords) by reading .robot files, RobotCode teaches the agent to use the robotcode CLI. This allows the agent to discover tests, run suites, inspect results, look up keywords, and debug at real breakpoints using the project's actual resolved configuration (robot.toml, profiles, etc.).
  3. Overview of robotcode tool capabilities

    The robotcode tool provides a comprehensive suite for managing Robot Framework projects, including:

    • CLI: Command-line interface for test execution, code analysis, and debugging.
    • Configuration: Centralized project settings via robot.toml for environment profiles and dependency management.
    • Static Analysis: Code analysis via robotcode analyze code and diagnostic control using # robotcode: inline modifiers.
    • Test Management: Discovery of tests, tasks, and suites via robotcode discover and analysis of execution results via robotcode results (processing output.xml).
    • Interactive Development: A keyword-driven REPL via robotcode repl and a command-line debugger via robotcode robot-debug.
    • Execution Wrappers: Ability to run tests through a command prefix (e.g., xvfb-run) using the --wrapper flag or robot.toml settings.
    • AI Agent Integration: Support for AI coding agents (like GitHub Copilot Chat or Claude Code) to interact with the project via the robotcode CLI.
  4. Overview of RobotCode for Robot Framework

    RobotCode is a suite of tools, extensions, and plugins designed for Robot Framework development across various IDEs and the command line. It is built on the Robot Framework Core (ensuring syntax and behavior consistency) and utilizes the Language Server Protocol (LSP), making it compatible with any editor that supports LSP (e.g., VS Code, IntelliJ, Neovim, Sublime Text).
  5. Use the RobotCode REPL for interactive development

    robotcode repl (alias shell) is an interactive shell that executes Robot Framework syntax line-by-line. It maintains state across lines within a session, allowing you to import libraries and assign variables without creating a .robot file.

    Prompt Indicators:

    • >>> : Primary prompt for single keyword lines.
    • ... : Continuation prompt for multi-line constructs (e.g., FOR, WHILE, IF, TRY).

    Exiting: Press Enter on an empty >>> line, or use Ctrl-C to clear the buffer/exit.

    # Start the interactive prompt
    robotcode repl
  6. Generate a full project hierarchy with robotcode discover all

    The all subcommand prints the complete hierarchy: workspace root, suites, sub-suites, and tests/tasks. It is used to get a comprehensive overview of the project structure.
    robotcode discover all
    robotcode discover all ./tests/login        # restrict to a path
    robotcode discover all --include smoke      # restrict to a tag
  7. Analyze Robot Framework run results using robotcode results

    The robotcode results command provides a scriptable way to analyze Robot Framework result files (output.xml or output.json) directly in the terminal or pipeline. It is designed for developers triaging failures, CI/CD regression gates, and AI-driven failure analysis.
  8. Configure Robot Framework projects using robot.toml

    The robot.toml file provides a centralized configuration system for Robot Framework projects, replacing the need for multiple argument files or complex batch scripts. It allows settings to be version-controlled and shared across environments. All standard Robot Framework command-line options can be configured here; multi-word options use hyphens (e.g., --outputdir becomes output-dir).
    # Basic settings
    output-dir = "output"
    log-level = "INFO"
    languages = ["en", "fi"]
    
    # Global variables
    [variables]
    BROWSER = "Chrome"
    LOGIN_URL = "https://example.com/login"
    TIMEOUT = "20s"
  9. Analyze the `results summary` JSON output

    The summary subcommand provides a high-level overview of the run.

    • The failed array only appears if the --failed flag was passed.
    • messagesCount aggregates log messages by level (TRACE, DEBUG, INFO, WARN, ERROR, FAIL). Empty buckets are omitted.
    • executionMessagesCount appears only if parser or discovery errors occurred outside of test execution.
    • filtersApplied appears if any filter was used.
    {
      "file": { "source": "results/output.xml", "relSource": "results/output.xml" },
      "status": "FAIL",
      "counts": { "total": 42, "passed": 37, "failed": 2, "skipped": 3, "notRun": 0 },
      "elapsedSeconds": 83.4,
      "startTime": "2026-05-15T08:11:02",
      "endTime": "2026-05-15T08:12:25",
      "failed": [
        {
          "name": "Bad Password",
          "fullName": "MyProject.Login.Bad Password",
          "suite": "MyProject.Login",
          "status": "FAIL",
          "message": "AssertionError: Expected 'Login failed' but got 'Internal error'",
          "tags": ["smoke"],
          "elapsedSeconds": 0.234,
          "startTime": "2026-05-15T08:11:04",
          "source": "tests/login/test_login.robot",
          "relSource": "tests/login/test_login.robot",
          "lineno": 42
        }
      ],
      "messagesCount": { "INFO": 318, "WARN": 7, "FAIL": 2 }
    }
  10. Control diagnostic severity using RobotCode modifiers

    RobotCode allows you to control which diagnostic messages (lint/analysis errors, warnings, hints) are shown and their severity directly in Robot code using special comments starting with # robotcode:.

    Modifiers can be used to hide specific rules, adjust severity (e.g., downgrade an error to a hint), or disable diagnostics entirely. Modifiers are case-insensitive and can be chained in a single comment. If the same diagnostic code appears multiple times in one comment, the rightmost action takes precedence.

    # robotcode: <action>[code1,code2,...] [<action>[code1,code2,...]]...
  11. RobotCode REPL prompt-toolkit backend features

    The default prompt-toolkit backend provides several advanced UI features over the plain backend:

    • Live Candidate Popup: Completions appear as you type with docstring hints for keywords and value previews for variables.
    • Fish-style Auto-suggest: Greyed-out suggestions of previous matching commands (press Right-arrow to accept).
    • Argument Signature Toolbar: A status line at the bottom showing the keyword's signature and highlighting the active argument being typed.
    • Syntax Highlighting: Colored syntax for keywords, variables, block constructs, and BDD prefixes, matching the RobotCode VS Code extension.
    • Enhanced Navigation: Bracket auto-matching and Ctrl-R reverse search UI.