or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

builtin-libraries.mdconfiguration-variables.mdcore-execution.mdindex.mdlibrary-development.mdparsing-model.md
tile.json

tessl/pypi-robotframework

Generic automation framework for acceptance testing and robotic process automation (RPA)

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/robotframework@7.3.x

To install, run

npx @tessl/cli install tessl/pypi-robotframework@7.3.0

index.mddocs/

Robot Framework

Robot Framework is a comprehensive automation framework designed for acceptance testing, acceptance test-driven development (ATDD), and robotic process automation (RPA). It features a plain text syntax that makes test creation accessible to both technical and non-technical users, while supporting extensive customization through generic and custom libraries.

Package Information

  • Package Name: robotframework
  • Language: Python
  • Installation: pip install robotframework
  • Python Compatibility: 3.8+
  • License: Apache License 2.0

Core Imports

Main programmatic APIs:

from robot import run, run_cli, rebot, rebot_cli

Public API classes and functions:

from robot.api import (
    TestSuite, TestSuiteBuilder, ResultWriter, ExecutionResult, ResultVisitor,
    SuiteVisitor, TypeInfo, Languages, Language
)

Library development APIs:

from robot.api import keyword, library, not_keyword
from robot.api import Failure, ContinuableFailure, Error, FatalError, SkipExecution
from robot.api import logger
from robot.api.interfaces import DynamicLibrary, HybridLibrary, ListenerV2, ListenerV3, Parser

Parsing APIs:

from robot.api.parsing import get_model, get_tokens, Token, ModelVisitor, ModelTransformer

Basic Usage

Running Tests Programmatically

from robot import run

# Run tests from a directory
result = run('tests/')

# Run specific test files with options
result = run('tests/example.robot', outputdir='results', loglevel='DEBUG')

# Run with custom settings
result = run(
    'tests/',
    outputdir='results',
    report='custom_report.html',
    log='custom_log.html',
    include=['smoke', 'critical'],
    exclude=['slow']
)

print(f"Tests run: {result.return_code}")

Creating Test Suites Programmatically

from robot.api import TestSuite

# Create a test suite
suite = TestSuite('Example Suite')

# Add a test case
test = suite.tests.create('Example Test')
test.keywords.create('Log', args=['Hello, Robot Framework!'])
test.keywords.create('Should Be Equal', args=['${GREETING}', 'Hello'])

# Run the suite
result = suite.run(outputdir='results')

Processing Test Results

from robot.api import ExecutionResult

# Read execution results from XML
result = ExecutionResult('output.xml')

# Access test statistics
print(f"Total tests: {result.suite.test_count}")
print(f"Passed: {result.suite.statistics.passed}")
print(f"Failed: {result.suite.statistics.failed}")

# Iterate through test cases
for test in result.suite.tests:
    print(f"Test: {test.name} - Status: {test.status}")

Architecture

Robot Framework follows a layered architecture that separates concerns and enables extensibility:

Core Components

  • Test Execution Engine: Orchestrates test execution, keyword resolution, and result collection
  • Test Data Parser: Converts test files into executable test suite objects
  • Keyword Library System: Manages built-in and custom test libraries with their keywords
  • Variable System: Handles variable resolution, scoping, and evaluation
  • Result Processing: Generates reports, logs, and output files from execution results

Extensibility Points

  • Test Libraries: Custom keyword implementations using static, dynamic, or hybrid APIs
  • Listeners: Event-driven extensions that monitor and react to test execution events
  • Parsers: Custom parsers for non-standard test data formats
  • Pre-run/Pre-rebot Modifiers: Suite and result processing extensions
  • Remote Libraries: Network-accessible keyword implementations

This architecture enables Robot Framework to support diverse testing scenarios while maintaining simplicity for end users and providing powerful extension points for advanced use cases.

Capabilities

Core Execution

Test execution, result processing, and programmatic control of Robot Framework's main functionality. Includes running tests, processing outputs, and accessing execution results.

def run(*tests, **options): ...
def run_cli(arguments=None, exit=True): ...
def rebot(*outputs, **options): ...
def rebot_cli(arguments=None, exit=True): ...

class TestSuite: ...
class TestSuiteBuilder: ...
class ExecutionResult: ...
class ResultWriter: ...

Core Execution

Library Development

APIs for creating custom test libraries, including decorators, exceptions, logging, and base classes for different library types.

@keyword(name=None, tags=(), types=())
@library(scope=None, version=None, auto_keywords=False)
@not_keyword

class Failure(AssertionError): ...
class Error(RuntimeError): ...
class SkipExecution(Exception): ...

def info(msg: str, html: bool = False, also_console: bool = False): ...
def warn(msg: str, html: bool = False): ...
def error(msg: str, html: bool = False): ...

Library Development

Parsing and Model

Test data parsing, AST model manipulation, and programmatic access to Robot Framework's internal data structures.

def get_model(source, **options): ...
def get_tokens(source, **options): ...

class Token: ...
class ModelVisitor: ...
class ModelTransformer: ...
class SuiteVisitor: ...

Parsing and Model

Built-in Libraries

Standard test libraries that provide essential keywords for common testing tasks including system operations, data manipulation, and test control flow.

class BuiltIn: ...
class Collections: ...
class String: ...
class OperatingSystem: ...
class Process: ...
class DateTime: ...

Built-in Libraries

Configuration and Variables

Settings, language support, type conversion, and variable handling systems for customizing Robot Framework behavior.

class TypeInfo: ...
class Languages: ...
class Language: ...

def contains_variable(string): ...
def is_variable(string): ...
def evaluate_expression(expression, variables): ...

Configuration and Variables

Documentation Tools

Robot Framework includes tools for generating documentation from test libraries and test suites:

Library Documentation (Libdoc)

def libdoc_cli(arguments=None, exit=True): ...
def libdoc(library_or_resource, outfile, **options): ...

Generate HTML documentation for test libraries showing available keywords, their arguments, and documentation.

Test Documentation (Testdoc)

def testdoc_cli(arguments): ...
def testdoc(*arguments, **options): ...

Generate HTML documentation from test suites showing test cases, keywords, and test data structure.

Command Line Tools

Robot Framework provides three main command line tools:

  • robot - Execute tests and generate results
  • rebot - Post-process existing result files
  • libdoc - Generate library documentation

These tools can also be invoked programmatically through their corresponding CLI functions.

Types

Core type definitions used throughout the Robot Framework API:

# Execution types
TestResult = int  # Return code: 0 for success, non-zero for failures/errors

# Library interface types  
Name = str
Arguments = Sequence[Union[str, Tuple[str], Tuple[str, Any]]]
Documentation = str
Tags = Sequence[str]
TypeHints = Union[Mapping[str, TypeHint], Sequence[TypeHint]]

# Parsing types
Token = Union[str, Tuple[str, str], Tuple[str, str, int, int]]

# Logging types
LOGLEVEL = Literal["TRACE", "DEBUG", "INFO", "WARN", "ERROR"]

# Decorator types
Scope = Literal["GLOBAL", "SUITE", "TEST", "TASK"]
DocFormat = Literal["ROBOT", "HTML", "TEXT", "REST"]