@memberjunction/testing-engine-base 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# @memberjunction/testing-engine-base
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
graph TD
|
|
9
|
+
subgraph "@memberjunction/testing-engine-base"
|
|
10
|
+
A[TestEngineBase] --> B[Test Types Cache]
|
|
11
|
+
A --> C[Tests Cache]
|
|
12
|
+
A --> D[Test Suites Cache]
|
|
13
|
+
A --> E[Test Rubrics Cache]
|
|
14
|
+
A --> F[Suite Tests Cache]
|
|
15
|
+
G[Types Module] --> H[TestRunOptions]
|
|
16
|
+
G --> I[SuiteRunOptions]
|
|
17
|
+
G --> J[TestRunResult]
|
|
18
|
+
G --> K[TestSuiteRunResult]
|
|
19
|
+
G --> L[Variable System Types]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
subgraph "Data Sources"
|
|
23
|
+
M["MJ: Test Types"]
|
|
24
|
+
N["MJ: Tests"]
|
|
25
|
+
O["MJ: Test Suites"]
|
|
26
|
+
P["MJ: Test Rubrics"]
|
|
27
|
+
Q["MJ: Test Suite Tests"]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
M --> B
|
|
31
|
+
N --> C
|
|
32
|
+
O --> D
|
|
33
|
+
P --> E
|
|
34
|
+
Q --> F
|
|
35
|
+
|
|
36
|
+
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
37
|
+
style B fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
38
|
+
style C fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
39
|
+
style D fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
40
|
+
style E fill:#7c5295,stroke:#563a6b,color:#fff
|
|
41
|
+
style G fill:#b8762f,stroke:#8a5722,color:#fff
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Overview
|
|
45
|
+
|
|
46
|
+
This package serves two purposes:
|
|
47
|
+
|
|
48
|
+
1. **Metadata Caching**: `TestEngineBase` is a singleton engine that loads and caches all testing metadata, providing fast lookups by ID, name, type, and tag
|
|
49
|
+
2. **Shared Types**: Comprehensive type definitions for test execution, results, variables, and configuration used across the entire testing stack
|
|
50
|
+
|
|
51
|
+
**Key capabilities:**
|
|
52
|
+
|
|
53
|
+
- Cached access to test types, tests, suites, rubrics, and suite-test associations
|
|
54
|
+
- Lookup methods by ID, name, type, and tag
|
|
55
|
+
- Active-only filtering for tests and suites
|
|
56
|
+
- Suite test sequencing with proper sort order
|
|
57
|
+
- Complete type system for test execution, results, validation, and variables
|
|
58
|
+
- Progress and logging callback interfaces for real-time execution updates
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install @memberjunction/testing-engine-base
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
### Loading Metadata
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { TestEngineBase } from '@memberjunction/testing-engine-base';
|
|
72
|
+
|
|
73
|
+
const engine = TestEngineBase.Instance;
|
|
74
|
+
await engine.Config(false, contextUser);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Querying Tests
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// By type
|
|
81
|
+
const agentTests = engine.GetTestsByType(typeId);
|
|
82
|
+
|
|
83
|
+
// By tag
|
|
84
|
+
const regressionTests = engine.GetTestsByTag('regression');
|
|
85
|
+
|
|
86
|
+
// By name
|
|
87
|
+
const test = engine.GetTestByName('Agent Summarization Test');
|
|
88
|
+
|
|
89
|
+
// Active only
|
|
90
|
+
const activeTests = engine.GetActiveTests();
|
|
91
|
+
const activeSuites = engine.GetActiveTestSuites();
|
|
92
|
+
|
|
93
|
+
// Tests in a suite (sorted by sequence)
|
|
94
|
+
const suiteTests = engine.GetTestsForSuite(suiteId);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Using Types
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import {
|
|
101
|
+
TestRunOptions,
|
|
102
|
+
SuiteRunOptions,
|
|
103
|
+
TestRunResult,
|
|
104
|
+
TestSuiteRunResult,
|
|
105
|
+
OracleResult,
|
|
106
|
+
TestRunVariables
|
|
107
|
+
} from '@memberjunction/testing-engine-base';
|
|
108
|
+
|
|
109
|
+
// Configure a test run
|
|
110
|
+
const options: TestRunOptions = {
|
|
111
|
+
verbose: true,
|
|
112
|
+
environment: 'staging',
|
|
113
|
+
gitCommit: 'abc123',
|
|
114
|
+
variables: { AIConfiguration: 'gpt-4o', Temperature: 0.7 },
|
|
115
|
+
progressCallback: (progress) => console.log(progress.message)
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// Suite run options add parallel/failFast controls
|
|
119
|
+
const suiteOptions: SuiteRunOptions = {
|
|
120
|
+
...options,
|
|
121
|
+
parallel: true,
|
|
122
|
+
maxParallel: 5,
|
|
123
|
+
failFast: false
|
|
124
|
+
};
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Type Reference
|
|
128
|
+
|
|
129
|
+
### Core Result Types
|
|
130
|
+
|
|
131
|
+
| Type | Description |
|
|
132
|
+
|------|-------------|
|
|
133
|
+
| `TestRunResult` | Complete result from a single test execution |
|
|
134
|
+
| `TestSuiteRunResult` | Aggregate result from a suite execution |
|
|
135
|
+
| `OracleResult` | Result from an individual oracle evaluation |
|
|
136
|
+
| `ValidationResult` | Configuration validation result with errors/warnings |
|
|
137
|
+
|
|
138
|
+
### Execution Options
|
|
139
|
+
|
|
140
|
+
| Type | Description |
|
|
141
|
+
|------|-------------|
|
|
142
|
+
| `TestRunOptions` | Options for running a single test (verbose, dryRun, variables, etc.) |
|
|
143
|
+
| `SuiteRunOptions` | Options for running a suite (parallel, failFast, sequence filters) |
|
|
144
|
+
| `TestProgress` | Progress callback data (step, percentage, message) |
|
|
145
|
+
| `TestLogMessage` | Log message from test execution (level, message, metadata) |
|
|
146
|
+
|
|
147
|
+
### Variable System
|
|
148
|
+
|
|
149
|
+
| Type | Description |
|
|
150
|
+
|------|-------------|
|
|
151
|
+
| `TestTypeVariablesSchema` | Schema defining available variables for a test type |
|
|
152
|
+
| `TestVariableDefinition` | Single variable definition (name, dataType, valueSource, etc.) |
|
|
153
|
+
| `TestVariablesConfig` | Variable overrides at the test level |
|
|
154
|
+
| `TestSuiteVariablesConfig` | Variable values at the suite level |
|
|
155
|
+
| `ResolvedTestVariables` | Final resolved values with source tracking |
|
|
156
|
+
| `TestRunVariables` | Variable values provided at run time |
|
|
157
|
+
|
|
158
|
+
### Context Types
|
|
159
|
+
|
|
160
|
+
| Type | Description |
|
|
161
|
+
|------|-------------|
|
|
162
|
+
| `RunContextDetails` | Execution environment details (OS, Node.js, CI/CD, git info) |
|
|
163
|
+
| `OracleConfig` | Oracle-specific configuration properties |
|
|
164
|
+
| `ScoringWeights` | Weights for different oracle evaluation dimensions |
|
|
165
|
+
|
|
166
|
+
## Relationship to Other Testing Packages
|
|
167
|
+
|
|
168
|
+
```mermaid
|
|
169
|
+
graph LR
|
|
170
|
+
A["testing-engine-base<br/>(Metadata + Types)"] --> B["testing-engine<br/>(Execution)"]
|
|
171
|
+
B --> C["testing-cli<br/>(CLI Interface)"]
|
|
172
|
+
|
|
173
|
+
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
174
|
+
style B fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
175
|
+
style C fill:#7c5295,stroke:#563a6b,color:#fff
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Dependencies
|
|
179
|
+
|
|
180
|
+
| Package | Purpose |
|
|
181
|
+
|---------|---------|
|
|
182
|
+
| `@memberjunction/core` | BaseEngine, UserInfo, IMetadataProvider |
|
|
183
|
+
| `@memberjunction/core-entities` | Test entity types |
|
|
184
|
+
| `@memberjunction/global` | MJGlobal utilities |
|
|
185
|
+
| `rxjs` | Observable patterns |
|
|
186
|
+
| `debug` | Debug logging |
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/testing-engine-base",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"description": "MemberJunction Testing Framework Engine Base - Metadata cache for test types, suites, and tests (UI-safe, no execution)",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"@types/debug": "^4.1.12"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@memberjunction/global": "4.
|
|
25
|
-
"@memberjunction/core": "4.
|
|
26
|
-
"@memberjunction/core-entities": "4.
|
|
24
|
+
"@memberjunction/global": "4.1.0",
|
|
25
|
+
"@memberjunction/core": "4.1.0",
|
|
26
|
+
"@memberjunction/core-entities": "4.1.0",
|
|
27
27
|
"rxjs": "^7.8.2",
|
|
28
28
|
"debug": "^4.4.3"
|
|
29
29
|
},
|