@memberjunction/testing-cli
Command-line interface for the MemberJunction Testing Framework. Provides commands for running tests, managing suites, viewing history, comparing runs, generating reports, and validating configurations.
Architecture
Section titled “Architecture”graph TD
subgraph "@memberjunction/testing-cli"
A[CLI Entry Point] --> B[Commands]
B --> C[run]
B --> D[suite]
B --> E[list]
B --> F[history]
B --> G[compare]
B --> H[report]
B --> I[validate]
A --> J[Utilities]
J --> K[Config Loader]
J --> L[Output Formatter]
J --> M[Spinner Manager]
J --> N[Variable Parser]
A --> O[MJ Provider]
end
subgraph "Engine Layer"
P["@memberjunction/testing-engine<br/>(Execution)"]
Q["@memberjunction/testing-engine-base<br/>(Metadata)"]
end
C --> P
D --> P
E --> Q
F --> Q
G --> Q
I --> P
style A fill:#2d6a9f,stroke:#1a4971,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 F fill:#7c5295,stroke:#563a6b,color:#fff
style G fill:#b8762f,stroke:#8a5722,color:#fff
style H fill:#b8762f,stroke:#8a5722,color:#fff
style I fill:#7c5295,stroke:#563a6b,color:#fff
style O fill:#2d6a9f,stroke:#1a4971,color:#fff
Overview
Section titled “Overview”This package provides the CLI layer on top of the MemberJunction Testing Engine. It is designed to be used both standalone and as an integrated part of the mj test command group in the MemberJunction CLI.
Available commands:
| Command | Description |
|---|---|
run | Execute a single test by ID or name |
suite | Execute a test suite with parallel/sequential control |
list | List available tests, suites, and types |
history | View execution history for tests or suites |
compare | Compare results across multiple test runs |
report | Generate execution reports |
validate | Validate test or suite configurations without executing |
Installation
Section titled “Installation”npm install @memberjunction/testing-cliCommands
Section titled “Commands”run — Execute a Test
Section titled “run — Execute a Test”# Run by test namemj test run --name "Agent Summarization Test"
# Run by test IDmj test run --id "test-guid"
# With variablesmj test run --name "My Test" --var AIConfiguration=gpt-4o --var Temperature=0.3
# Verbose outputmj test run --name "My Test" --verbose
# Dry run (validate only)mj test run --name "My Test" --dry-runsuite — Execute a Suite
Section titled “suite — Execute a Suite”# Run a suitemj test suite --name "Regression Suite"
# Parallel executionmj test suite --name "Suite" --parallel --max-parallel 5
# Stop on first failuremj test suite --name "Suite" --fail-fast
# Run specific sequence rangemj test suite --name "Suite" --sequence-start 3 --sequence-end 7list — List Tests and Suites
Section titled “list — List Tests and Suites”# List all testsmj test list
# List test suitesmj test list --suites
# List test typesmj test list --typeshistory — View History
Section titled “history — View History”# View test run historymj test history --name "My Test"
# View suite run historymj test history --suite "My Suite"compare — Compare Runs
Section titled “compare — Compare Runs”# Compare two test runsmj test compare --run1 "run-id-1" --run2 "run-id-2"validate — Validate Configuration
Section titled “validate — Validate Configuration”# Validate a testmj test validate --name "My Test"
# Validate a suitemj test validate --suite "My Suite"Configuration
Section titled “Configuration”The CLI uses cosmiconfig to load configuration from:
.mjtestrc.mjtestrc.jsonmj.config.cjs(in thetestingsection)
Configuration includes database connection settings for the MJ Provider.
Utilities
Section titled “Utilities”| Utility | Description |
|---|---|
ConfigLoader | Loads CLI configuration via cosmiconfig |
OutputFormatter | Formats test results for terminal display with chalk |
SpinnerManager | Manages ora spinners for long-running operations |
VariableParser | Parses --var key=value CLI arguments into typed variables |
MJProvider | Initializes the MemberJunction SQL Server data provider |
Dependencies
Section titled “Dependencies”| Package | Purpose |
|---|---|
@memberjunction/testing-engine | Test execution engine |
@memberjunction/testing-engine-base | Metadata and types |
@memberjunction/core | Core MJ functionality |
@memberjunction/core-entities | Entity types |
@memberjunction/sqlserver-dataprovider | Database connectivity |
@oclif/core | CLI framework |
chalk | Terminal styling |
ora-classic | Terminal spinners |
cosmiconfig | Configuration loading |
License
Section titled “License”ISC