Skip to content

@memberjunction/testing-engine-base

Base engine for MemberJunction’s testing framework. Provides metadata caching for test types, tests, suites, rubrics, and shared type definitions. UI-safe — contains no execution logic.

graph TD
    subgraph "@memberjunction/testing-engine-base"
        A[TestEngineBase] --> B[Test Types Cache]
        A --> C[Tests Cache]
        A --> D[Test Suites Cache]
        A --> E[Test Rubrics Cache]
        A --> F[Suite Tests Cache]
        G[Types Module] --> H[TestRunOptions]
        G --> I[SuiteRunOptions]
        G --> J[TestRunResult]
        G --> K[TestSuiteRunResult]
        G --> L[Variable System Types]
    end

    subgraph "Data Sources"
        M["MJ: Test Types"]
        N["MJ: Tests"]
        O["MJ: Test Suites"]
        P["MJ: Test Rubrics"]
        Q["MJ: Test Suite Tests"]
    end

    M --> B
    N --> C
    O --> D
    P --> E
    Q --> F

    style A fill:#2d6a9f,stroke:#1a4971,color:#fff
    style B fill:#2d8659,stroke:#1a5c3a,color:#fff
    style C fill:#2d8659,stroke:#1a5c3a,color:#fff
    style D fill:#2d8659,stroke:#1a5c3a,color:#fff
    style E fill:#7c5295,stroke:#563a6b,color:#fff
    style G fill:#b8762f,stroke:#8a5722,color:#fff

This package serves two purposes:

  1. Metadata Caching: TestEngineBase is a singleton engine that loads and caches all testing metadata, providing fast lookups by ID, name, type, and tag
  2. Shared Types: Comprehensive type definitions for test execution, results, variables, and configuration used across the entire testing stack

Key capabilities:

  • Cached access to test types, tests, suites, rubrics, and suite-test associations
  • Lookup methods by ID, name, type, and tag
  • Active-only filtering for tests and suites
  • Suite test sequencing with proper sort order
  • Complete type system for test execution, results, validation, and variables
  • Progress and logging callback interfaces for real-time execution updates
Terminal window
npm install @memberjunction/testing-engine-base
import { TestEngineBase } from '@memberjunction/testing-engine-base';
const engine = TestEngineBase.Instance;
await engine.Config(false, contextUser);
// By type
const agentTests = engine.GetTestsByType(typeId);
// By tag
const regressionTests = engine.GetTestsByTag('regression');
// By name
const test = engine.GetTestByName('Agent Summarization Test');
// Active only
const activeTests = engine.GetActiveTests();
const activeSuites = engine.GetActiveTestSuites();
// Tests in a suite (sorted by sequence)
const suiteTests = engine.GetTestsForSuite(suiteId);
import {
TestRunOptions,
SuiteRunOptions,
TestRunResult,
TestSuiteRunResult,
OracleResult,
TestRunVariables
} from '@memberjunction/testing-engine-base';
// Configure a test run
const options: TestRunOptions = {
verbose: true,
environment: 'staging',
gitCommit: 'abc123',
variables: { AIConfiguration: 'gpt-4o', Temperature: 0.7 },
progressCallback: (progress) => console.log(progress.message)
};
// Suite run options add parallel/failFast controls
const suiteOptions: SuiteRunOptions = {
...options,
parallel: true,
maxParallel: 5,
failFast: false
};
TypeDescription
TestRunResultComplete result from a single test execution
TestSuiteRunResultAggregate result from a suite execution
OracleResultResult from an individual oracle evaluation
ValidationResultConfiguration validation result with errors/warnings
TypeDescription
TestRunOptionsOptions for running a single test (verbose, dryRun, variables, etc.)
SuiteRunOptionsOptions for running a suite (parallel, failFast, sequence filters)
TestProgressProgress callback data (step, percentage, message)
TestLogMessageLog message from test execution (level, message, metadata)
TypeDescription
TestTypeVariablesSchemaSchema defining available variables for a test type
TestVariableDefinitionSingle variable definition (name, dataType, valueSource, etc.)
TestVariablesConfigVariable overrides at the test level
TestSuiteVariablesConfigVariable values at the suite level
ResolvedTestVariablesFinal resolved values with source tracking
TestRunVariablesVariable values provided at run time
TypeDescription
RunContextDetailsExecution environment details (OS, Node.js, CI/CD, git info)
OracleConfigOracle-specific configuration properties
ScoringWeightsWeights for different oracle evaluation dimensions
graph LR
    A["testing-engine-base<br/>(Metadata + Types)"] --> B["testing-engine<br/>(Execution)"]
    B --> C["testing-cli<br/>(CLI Interface)"]

    style A fill:#2d6a9f,stroke:#1a4971,color:#fff
    style B fill:#2d8659,stroke:#1a5c3a,color:#fff
    style C fill:#7c5295,stroke:#563a6b,color:#fff
PackagePurpose
@memberjunction/coreBaseEngine, UserInfo, IMetadataProvider
@memberjunction/core-entitiesTest entity types
@memberjunction/globalMJGlobal utilities
rxjsObservable patterns
debugDebug logging

ISC