Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:DevExpress Testcafe Runner Creation

From Leeroopedia
Knowledge Sources
Domains Testing, Web_Automation
Last Updated 2026-02-12 04:00 GMT

Overview

Runner Creation is the concept of instantiating a test execution engine from a framework instance, establishing the bridge between configuration and execution.

Description

A test framework instance provides infrastructure (proxies, browser connections), but requires a separate execution engine to coordinate test runs. Runner Creation produces this engine by cloning configuration from the parent instance and establishing event channels for test lifecycle events.

The runner acts as a session-scoped coordinator that can be configured independently without affecting the parent instance. Multiple runners can be created from a single framework instance, allowing parallel test sessions with different configurations. Each runner maintains its own execution state, warning logs, and reporter connections while sharing infrastructure resources like the proxy server and browser connection gateway.

The creation process involves cloning configuration to prevent mutation, initializing event buses for communication, creating a bootstrapper for test compilation and browser management, and registering the runner with the parent instance for lifecycle management.

Usage

Use Runner Creation when you need to execute tests programmatically and require explicit control over execution parameters. Create a runner after initializing the TestCafe instance and before configuring test sources or browsers.

Create multiple runners when you need to run different test suites in parallel with different configurations (different browsers, different reporter outputs, different test filters). Each runner maintains independent execution state while sharing the underlying infrastructure.

Avoid creating runners when using the CLI, as it handles runner creation automatically. The programmatic API is most valuable when integrating TestCafe into custom workflows, running tests conditionally, or coordinating multiple test sessions.

Theoretical Basis

The Builder Pattern underlies Runner Creation, allowing complex configuration to be applied incrementally before execution. The pattern separates the construction of the execution engine from its configuration, enabling a fluent interface for readable test setup.

Core Responsibilities

  1. Configuration Isolation: Clone parent configuration to prevent cross-runner mutation
  2. Event Infrastructure: Initialize message buses and event emitters for test lifecycle communication
  3. Bootstrapper Creation: Construct compiler and browser management components
  4. State Management: Initialize execution tracking structures (pending tasks, warning logs, API call flags)

Pseudocode

function createRunner(frameworkInstance, isLiveMode = false) {
    // Phase 1: Select runner type
    RunnerClass = isLiveMode ? LiveModeRunner : StandardRunner

    // Phase 2: Clone configuration
    isolatedConfig = frameworkInstance.configuration.clone()

    // Phase 3: Construct runner with shared resources
    runner = new RunnerClass({
        proxy: frameworkInstance.proxy,
        browserGateway: frameworkInstance.browserConnectionGateway,
        configuration: isolatedConfig
    })

    // Phase 4: Register with parent
    frameworkInstance.runners.push(runner)

    return runner
}

Related Pages

Implemented By

Related Principles

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment