@memberjunction/testing-cli 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 +125 -441
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,502 +1,186 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @memberjunction/testing-cli
|
|
2
2
|
|
|
3
|
-
Command-line interface for the MemberJunction Testing Framework. Provides
|
|
3
|
+
Command-line interface for the MemberJunction Testing Framework. Provides commands for running tests, managing suites, viewing history, comparing runs, generating reports, and validating configurations.
|
|
4
4
|
|
|
5
5
|
## Architecture
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
```mermaid
|
|
8
|
+
graph TD
|
|
9
|
+
subgraph "@memberjunction/testing-cli"
|
|
10
|
+
A[CLI Entry Point] --> B[Commands]
|
|
11
|
+
B --> C[run]
|
|
12
|
+
B --> D[suite]
|
|
13
|
+
B --> E[list]
|
|
14
|
+
B --> F[history]
|
|
15
|
+
B --> G[compare]
|
|
16
|
+
B --> H[report]
|
|
17
|
+
B --> I[validate]
|
|
18
|
+
|
|
19
|
+
A --> J[Utilities]
|
|
20
|
+
J --> K[Config Loader]
|
|
21
|
+
J --> L[Output Formatter]
|
|
22
|
+
J --> M[Spinner Manager]
|
|
23
|
+
J --> N[Variable Parser]
|
|
24
|
+
|
|
25
|
+
A --> O[MJ Provider]
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
subgraph "Engine Layer"
|
|
29
|
+
P["@memberjunction/testing-engine<br/>(Execution)"]
|
|
30
|
+
Q["@memberjunction/testing-engine-base<br/>(Metadata)"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
C --> P
|
|
34
|
+
D --> P
|
|
35
|
+
E --> Q
|
|
36
|
+
F --> Q
|
|
37
|
+
G --> Q
|
|
38
|
+
I --> P
|
|
39
|
+
|
|
40
|
+
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
41
|
+
style C fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
42
|
+
style D fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
43
|
+
style E fill:#7c5295,stroke:#563a6b,color:#fff
|
|
44
|
+
style F fill:#7c5295,stroke:#563a6b,color:#fff
|
|
45
|
+
style G fill:#b8762f,stroke:#8a5722,color:#fff
|
|
46
|
+
style H fill:#b8762f,stroke:#8a5722,color:#fff
|
|
47
|
+
style I fill:#7c5295,stroke:#563a6b,color:#fff
|
|
48
|
+
style O fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Overview
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
**Available commands:**
|
|
56
|
+
|
|
57
|
+
| Command | Description |
|
|
58
|
+
|---------|-------------|
|
|
59
|
+
| `run` | Execute a single test by ID or name |
|
|
60
|
+
| `suite` | Execute a test suite with parallel/sequential control |
|
|
61
|
+
| `list` | List available tests, suites, and types |
|
|
62
|
+
| `history` | View execution history for tests or suites |
|
|
63
|
+
| `compare` | Compare results across multiple test runs |
|
|
64
|
+
| `report` | Generate execution reports |
|
|
65
|
+
| `validate` | Validate test or suite configurations without executing |
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
8
68
|
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
↓
|
|
12
|
-
Testing CLI Commands (mj test *)
|
|
13
|
-
↓
|
|
14
|
-
Testing Engine (actual logic)
|
|
15
|
-
↓
|
|
16
|
-
Database / Entities
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This architecture allows:
|
|
20
|
-
- **CLI and API parity** - Same engine powers both interfaces
|
|
21
|
-
- **Thin CLI layer** - Commands focus on user interaction, not business logic
|
|
22
|
-
- **Testability** - Engine can be tested independently
|
|
23
|
-
- **Flexibility** - Easy to add GraphQL/REST APIs later
|
|
24
|
-
|
|
25
|
-
## Integration with MJCLI
|
|
26
|
-
|
|
27
|
-
The Testing CLI integrates with the main MJCLI package following the same pattern as MetadataSync:
|
|
28
|
-
|
|
29
|
-
**In MJCLI package** (`packages/MJCLI/src/commands/test/`):
|
|
30
|
-
```typescript
|
|
31
|
-
// Thin command that delegates to Testing CLI
|
|
32
|
-
import { RunCommand } from '@memberjunction/testing-cli';
|
|
33
|
-
|
|
34
|
-
export default class TestRun extends Command {
|
|
35
|
-
async run() {
|
|
36
|
-
// Minimal setup, delegate to testing CLI
|
|
37
|
-
await RunCommand.execute(this.parse);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**In Testing CLI package** (`packages/TestingFramework/CLI/src/commands/`):
|
|
43
|
-
```typescript
|
|
44
|
-
// Full implementation
|
|
45
|
-
export class RunCommand {
|
|
46
|
-
async execute(args, flags) {
|
|
47
|
-
// Use Testing Engine for actual work
|
|
48
|
-
const engine = new TestEngine();
|
|
49
|
-
const result = await engine.runTest(...);
|
|
50
|
-
// Format output for CLI
|
|
51
|
-
this.displayResults(result);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
69
|
+
```bash
|
|
70
|
+
npm install @memberjunction/testing-cli
|
|
54
71
|
```
|
|
55
72
|
|
|
56
73
|
## Commands
|
|
57
74
|
|
|
58
|
-
###
|
|
59
|
-
|
|
60
|
-
Run a single test or suite of tests.
|
|
75
|
+
### run -- Execute a Test
|
|
61
76
|
|
|
62
77
|
```bash
|
|
63
|
-
# Run
|
|
64
|
-
mj test run
|
|
65
|
-
|
|
66
|
-
# Run test by name
|
|
67
|
-
mj test run --name="Active Members Count"
|
|
68
|
-
|
|
69
|
-
# Run test suite
|
|
70
|
-
mj test run --suite=<suite-id>
|
|
71
|
-
|
|
72
|
-
# Run with filtering
|
|
73
|
-
mj test run --tag=smoke
|
|
74
|
-
mj test run --category=agent-eval
|
|
75
|
-
mj test run --difficulty=easy
|
|
76
|
-
|
|
77
|
-
# Run all tests
|
|
78
|
-
mj test run --all
|
|
78
|
+
# Run by test name
|
|
79
|
+
mj test run --name "Agent Summarization Test"
|
|
79
80
|
|
|
80
|
-
#
|
|
81
|
-
mj test run
|
|
81
|
+
# Run by test ID
|
|
82
|
+
mj test run --id "test-guid"
|
|
82
83
|
|
|
83
|
-
#
|
|
84
|
-
mj test run
|
|
84
|
+
# With variables
|
|
85
|
+
mj test run --name "My Test" --var AIConfiguration=gpt-4o --var Temperature=0.3
|
|
85
86
|
|
|
86
|
-
#
|
|
87
|
-
mj test run
|
|
88
|
-
mj test run <test-id> --format=markdown
|
|
89
|
-
mj test run <test-id> --format=console (default)
|
|
87
|
+
# Verbose output
|
|
88
|
+
mj test run --name "My Test" --verbose
|
|
90
89
|
|
|
91
|
-
#
|
|
92
|
-
mj test run
|
|
90
|
+
# Dry run (validate only)
|
|
91
|
+
mj test run --name "My Test" --dry-run
|
|
93
92
|
```
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
[TEST_START] Active Members Count
|
|
98
|
-
[TYPE] Agent Eval
|
|
99
|
-
[CONTEXT] {"testId": "abc-123", "environment": "staging"}
|
|
100
|
-
|
|
101
|
-
[STEP 1/3] Execute Agent
|
|
102
|
-
[INPUT] "How many active members do we have?"
|
|
103
|
-
[AGENT] Skip Analytics Agent
|
|
104
|
-
[DURATION] 1.8s
|
|
105
|
-
✓ Agent executed successfully
|
|
106
|
-
|
|
107
|
-
[STEP 2/3] Run Oracles
|
|
108
|
-
[ORACLE] trace-no-errors: PASSED ✓
|
|
109
|
-
[ORACLE] sql-validate: COUNT(*) = 402 (expected 380-420) ✓
|
|
110
|
-
[ORACLE] schema-validate: Output matches schema ✓
|
|
111
|
-
|
|
112
|
-
[STEP 3/3] Calculate Score
|
|
113
|
-
[PASSED_CHECKS] 3/3
|
|
114
|
-
[SCORE] 1.0000 (100%)
|
|
115
|
-
[COST] $0.0042 USD
|
|
116
|
-
|
|
117
|
-
[TEST_PASS] Active Members Count
|
|
118
|
-
[DURATION] 1.8s
|
|
119
|
-
[TRACE_ID] Agent Run: abc-xyz-123
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### `mj test suite`
|
|
123
|
-
|
|
124
|
-
Run a complete test suite.
|
|
94
|
+
### suite -- Execute a Suite
|
|
125
95
|
|
|
126
96
|
```bash
|
|
127
|
-
# Run suite
|
|
128
|
-
mj test suite
|
|
129
|
-
|
|
130
|
-
# Run suite by name
|
|
131
|
-
mj test suite --name="Agent Quality Suite"
|
|
97
|
+
# Run a suite
|
|
98
|
+
mj test suite --name "Regression Suite"
|
|
132
99
|
|
|
133
100
|
# Parallel execution
|
|
134
|
-
mj test suite
|
|
101
|
+
mj test suite --name "Suite" --parallel --max-parallel 5
|
|
135
102
|
|
|
136
|
-
#
|
|
137
|
-
mj test suite
|
|
103
|
+
# Stop on first failure
|
|
104
|
+
mj test suite --name "Suite" --fail-fast
|
|
138
105
|
|
|
139
|
-
#
|
|
140
|
-
mj test suite
|
|
106
|
+
# Run specific sequence range
|
|
107
|
+
mj test suite --name "Suite" --sequence-start 3 --sequence-end 7
|
|
141
108
|
```
|
|
142
109
|
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
[SUITE_START] Agent Quality Suite
|
|
146
|
-
[TESTS] 15 tests queued
|
|
147
|
-
|
|
148
|
-
[1/15] Active Members Count
|
|
149
|
-
✓ PASSED (1.8s, score: 1.0000)
|
|
150
|
-
|
|
151
|
-
[2/15] Revenue Year-to-Date
|
|
152
|
-
✓ PASSED (2.1s, score: 0.9500)
|
|
153
|
-
|
|
154
|
-
[3/15] Complex Aggregation
|
|
155
|
-
✗ FAILED (3.2s, score: 0.6000)
|
|
156
|
-
- Oracle 'llm-judge' failed: Component quality below threshold
|
|
157
|
-
|
|
158
|
-
...
|
|
159
|
-
|
|
160
|
-
[SUITE_COMPLETE] Agent Quality Suite
|
|
161
|
-
[SUMMARY] 13/15 passed (86.7%)
|
|
162
|
-
[DURATION] 28.4s
|
|
163
|
-
[COST] $0.12 USD
|
|
164
|
-
[FAILURES] 2 tests failed - see details above
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### `mj test list`
|
|
168
|
-
|
|
169
|
-
List available tests, suites, and types.
|
|
110
|
+
### list -- List Tests and Suites
|
|
170
111
|
|
|
171
112
|
```bash
|
|
172
113
|
# List all tests
|
|
173
114
|
mj test list
|
|
174
115
|
|
|
175
|
-
# List by type
|
|
176
|
-
mj test list --type=agent-eval
|
|
177
|
-
|
|
178
116
|
# List test suites
|
|
179
117
|
mj test list --suites
|
|
180
118
|
|
|
181
119
|
# List test types
|
|
182
120
|
mj test list --types
|
|
183
|
-
|
|
184
|
-
# Verbose output (show configuration)
|
|
185
|
-
mj test list --verbose
|
|
186
|
-
|
|
187
|
-
# Filter by tag
|
|
188
|
-
mj test list --tag=smoke
|
|
189
|
-
|
|
190
|
-
# Filter by status
|
|
191
|
-
mj test list --status=active
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
**Example Output:**
|
|
195
121
|
```
|
|
196
|
-
Available Tests (42):
|
|
197
|
-
|
|
198
|
-
Agent Evals (28):
|
|
199
|
-
- active-members-count [easy] Tags: membership, kpi
|
|
200
|
-
- revenue-ytd [easy] Tags: financial, kpi
|
|
201
|
-
- trend-analysis [medium] Tags: analytics, trends
|
|
202
|
-
- complex-aggregation [hard] Tags: advanced, performance
|
|
203
|
-
|
|
204
|
-
Workflow Scenarios (8):
|
|
205
|
-
- customer-onboarding [medium] Tags: workflow, customer
|
|
206
|
-
- invoice-processing [hard] Tags: financial, workflow
|
|
207
|
-
|
|
208
|
-
Test Suites (5):
|
|
209
|
-
- smoke-tests 15 tests
|
|
210
|
-
- regression-suite 42 tests
|
|
211
|
-
- nightly-full 87 tests
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### `mj test validate`
|
|
215
122
|
|
|
216
|
-
|
|
123
|
+
### history -- View History
|
|
217
124
|
|
|
218
125
|
```bash
|
|
219
|
-
#
|
|
220
|
-
mj test
|
|
221
|
-
|
|
222
|
-
# Validate all tests
|
|
223
|
-
mj test validate --all
|
|
224
|
-
|
|
225
|
-
# Validate by type
|
|
226
|
-
mj test validate --type=agent-eval
|
|
227
|
-
|
|
228
|
-
# Save validation report
|
|
229
|
-
mj test validate --all --save-report
|
|
126
|
+
# View test run history
|
|
127
|
+
mj test history --name "My Test"
|
|
230
128
|
|
|
231
|
-
#
|
|
232
|
-
mj test
|
|
129
|
+
# View suite run history
|
|
130
|
+
mj test history --suite "My Suite"
|
|
233
131
|
```
|
|
234
132
|
|
|
235
|
-
|
|
236
|
-
```
|
|
237
|
-
Validating Tests...
|
|
238
|
-
|
|
239
|
-
✓ active-members-count
|
|
240
|
-
- Configuration valid
|
|
241
|
-
- Oracles registered: trace-no-errors, sql-validate, schema-validate
|
|
242
|
-
- Expected outcomes defined
|
|
243
|
-
- No issues found
|
|
244
|
-
|
|
245
|
-
✗ complex-aggregation
|
|
246
|
-
- Configuration valid
|
|
247
|
-
- Oracles registered: trace-no-errors, llm-judge
|
|
248
|
-
⚠ Warning: Missing schema validation
|
|
249
|
-
⚠ Warning: LLM judge rubric not found: 'component-quality-v2'
|
|
250
|
-
|
|
251
|
-
✓ revenue-ytd
|
|
252
|
-
- Configuration valid
|
|
253
|
-
- Oracles registered: trace-no-errors, sql-validate
|
|
254
|
-
- Expected outcomes defined
|
|
255
|
-
- No issues found
|
|
256
|
-
|
|
257
|
-
[SUMMARY] 2/3 tests valid, 1 with warnings
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### `mj test report`
|
|
261
|
-
|
|
262
|
-
Generate test run reports.
|
|
133
|
+
### compare -- Compare Runs
|
|
263
134
|
|
|
264
135
|
```bash
|
|
265
|
-
#
|
|
266
|
-
mj test
|
|
267
|
-
|
|
268
|
-
# Date range
|
|
269
|
-
mj test report --from=2025-01-01 --to=2025-01-31
|
|
270
|
-
|
|
271
|
-
# Specific tests
|
|
272
|
-
mj test report --test=<test-id>
|
|
273
|
-
|
|
274
|
-
# Output formats
|
|
275
|
-
mj test report --format=markdown
|
|
276
|
-
mj test report --format=json
|
|
277
|
-
mj test report --format=html
|
|
278
|
-
|
|
279
|
-
# Save to file
|
|
280
|
-
mj test report --suite=<suite-id> --output=report.md
|
|
281
|
-
|
|
282
|
-
# Include cost analysis
|
|
283
|
-
mj test report --suite=<suite-id> --include-costs
|
|
284
|
-
|
|
285
|
-
# Include trends
|
|
286
|
-
mj test report --suite=<suite-id> --include-trends
|
|
136
|
+
# Compare two test runs
|
|
137
|
+
mj test compare --run1 "run-id-1" --run2 "run-id-2"
|
|
287
138
|
```
|
|
288
139
|
|
|
289
|
-
|
|
290
|
-
```markdown
|
|
291
|
-
# Test Report: Agent Quality Suite
|
|
292
|
-
Generated: 2025-01-09 14:30:00
|
|
293
|
-
|
|
294
|
-
## Summary
|
|
295
|
-
- **Suite:** Agent Quality Suite
|
|
296
|
-
- **Period:** Last 30 days
|
|
297
|
-
- **Total Runs:** 42
|
|
298
|
-
- **Success Rate:** 95.2%
|
|
299
|
-
- **Total Cost:** $5.28 USD
|
|
300
|
-
- **Avg Duration:** 28.4s
|
|
301
|
-
|
|
302
|
-
## Test Results
|
|
303
|
-
| Test Name | Runs | Pass Rate | Avg Score | Avg Cost | Trend |
|
|
304
|
-
|------------------------|------|-----------|-----------|----------|-------|
|
|
305
|
-
| Active Members Count | 42 | 100% | 1.0000 | $0.004 | → |
|
|
306
|
-
| Revenue YTD | 42 | 97.6% | 0.9850 | $0.005 | ↗ |
|
|
307
|
-
| Complex Aggregation | 42 | 85.7% | 0.8200 | $0.012 | ↘ |
|
|
308
|
-
|
|
309
|
-
## Failures
|
|
310
|
-
2 failures in the last 30 days:
|
|
311
|
-
|
|
312
|
-
### Complex Aggregation (2025-01-08)
|
|
313
|
-
- **Score:** 0.6000
|
|
314
|
-
- **Reason:** LLM judge failed - component quality below threshold
|
|
315
|
-
- **Cost:** $0.012
|
|
316
|
-
- **Trace:** [View Agent Run](link)
|
|
317
|
-
|
|
318
|
-
## Cost Analysis
|
|
319
|
-
- **Total Cost:** $5.28
|
|
320
|
-
- **Most Expensive Test:** Complex Aggregation ($0.50)
|
|
321
|
-
- **Cost Trend:** +12% vs previous month
|
|
322
|
-
|
|
323
|
-
## Recommendations
|
|
324
|
-
- Complex Aggregation: Review LLM judge rubric threshold
|
|
325
|
-
- Consider caching results for Active Members Count (no failures)
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### `mj test history`
|
|
329
|
-
|
|
330
|
-
View test execution history.
|
|
140
|
+
### validate -- Validate Configuration
|
|
331
141
|
|
|
332
142
|
```bash
|
|
333
|
-
#
|
|
334
|
-
mj test
|
|
335
|
-
|
|
336
|
-
# Recent runs
|
|
337
|
-
mj test history --recent=10
|
|
338
|
-
|
|
339
|
-
# By date range
|
|
340
|
-
mj test history --from=2025-01-01
|
|
143
|
+
# Validate a test
|
|
144
|
+
mj test validate --name "My Test"
|
|
341
145
|
|
|
342
|
-
#
|
|
343
|
-
mj test
|
|
344
|
-
|
|
345
|
-
# Show details
|
|
346
|
-
mj test history <test-id> --verbose
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### `mj test compare`
|
|
350
|
-
|
|
351
|
-
Compare test runs to detect regressions.
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
# Compare two specific runs
|
|
355
|
-
mj test compare <run-id-1> <run-id-2>
|
|
356
|
-
|
|
357
|
-
# Compare versions
|
|
358
|
-
mj test compare --version=2.1.0 --version=2.2.0
|
|
359
|
-
|
|
360
|
-
# Compare git commits
|
|
361
|
-
mj test compare --commit=abc123 --commit=def456
|
|
362
|
-
|
|
363
|
-
# Show only differences
|
|
364
|
-
mj test compare <run-id-1> <run-id-2> --diff-only
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
**Example Output:**
|
|
368
|
-
```
|
|
369
|
-
Comparing Test Runs:
|
|
370
|
-
Run 1: 2025-01-01 (v2.1.0, commit abc123)
|
|
371
|
-
Run 2: 2025-01-09 (v2.2.0, commit def456)
|
|
372
|
-
|
|
373
|
-
Test Results:
|
|
374
|
-
Active Members Count: SAME (1.0000 → 1.0000)
|
|
375
|
-
Revenue YTD: SAME (0.9850 → 0.9850)
|
|
376
|
-
Complex Aggregation: WORSE (0.9200 → 0.6000) ⚠
|
|
377
|
-
Trend Analysis: BETTER (0.7500 → 0.9100) ↗
|
|
378
|
-
|
|
379
|
-
Performance:
|
|
380
|
-
Avg Duration: BETTER (28.4s → 24.1s) ↗
|
|
381
|
-
Total Cost: WORSE ($0.12 → $0.18) ⚠
|
|
382
|
-
|
|
383
|
-
Summary: 1 regression detected in Complex Aggregation
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
## Output Formats
|
|
387
|
-
|
|
388
|
-
### Console (Default)
|
|
389
|
-
Human-readable, color-coded output with progress indicators and emojis.
|
|
390
|
-
|
|
391
|
-
### JSON
|
|
392
|
-
Machine-readable for CI/CD integration:
|
|
393
|
-
```json
|
|
394
|
-
{
|
|
395
|
-
"testId": "abc-123",
|
|
396
|
-
"status": "passed",
|
|
397
|
-
"score": 1.0,
|
|
398
|
-
"duration": 1.8,
|
|
399
|
-
"cost": 0.0042,
|
|
400
|
-
"oracleResults": [
|
|
401
|
-
{
|
|
402
|
-
"type": "trace-no-errors",
|
|
403
|
-
"passed": true,
|
|
404
|
-
"score": 1.0,
|
|
405
|
-
"message": "All 3 steps completed without errors"
|
|
406
|
-
}
|
|
407
|
-
]
|
|
408
|
-
}
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
### Markdown
|
|
412
|
-
Formatted reports for documentation:
|
|
413
|
-
```markdown
|
|
414
|
-
# Test Run: Active Members Count
|
|
415
|
-
**Status:** PASSED ✓
|
|
416
|
-
**Score:** 1.0000 (100%)
|
|
417
|
-
**Duration:** 1.8s
|
|
418
|
-
**Cost:** $0.0042
|
|
419
|
-
|
|
420
|
-
## Oracle Results
|
|
421
|
-
- ✓ trace-no-errors: All 3 steps completed without errors
|
|
422
|
-
- ✓ sql-validate: COUNT(*) = 402 (expected 380-420)
|
|
423
|
-
- ✓ schema-validate: Output matches schema
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
## CI/CD Integration
|
|
427
|
-
|
|
428
|
-
### GitHub Actions Example
|
|
429
|
-
```yaml
|
|
430
|
-
name: Test Suite
|
|
431
|
-
on: [push, pull_request]
|
|
432
|
-
|
|
433
|
-
jobs:
|
|
434
|
-
test-suite:
|
|
435
|
-
runs-on: ubuntu-latest
|
|
436
|
-
steps:
|
|
437
|
-
- uses: actions/checkout@v3
|
|
438
|
-
|
|
439
|
-
- name: Run Smoke Tests
|
|
440
|
-
run: mj test suite smoke-tests --fail-fast --format=json > results.json
|
|
441
|
-
|
|
442
|
-
- name: Check Results
|
|
443
|
-
run: |
|
|
444
|
-
if ! jq -e '.passRate >= 0.95' results.json; then
|
|
445
|
-
echo "Test pass rate below 95%"
|
|
446
|
-
exit 1
|
|
447
|
-
fi
|
|
448
|
-
|
|
449
|
-
- name: Upload Results
|
|
450
|
-
uses: actions/upload-artifact@v3
|
|
451
|
-
with:
|
|
452
|
-
name: test-results
|
|
453
|
-
path: results.json
|
|
146
|
+
# Validate a suite
|
|
147
|
+
mj test validate --suite "My Suite"
|
|
454
148
|
```
|
|
455
149
|
|
|
456
150
|
## Configuration
|
|
457
151
|
|
|
458
|
-
The CLI uses
|
|
459
|
-
|
|
460
|
-
```javascript
|
|
461
|
-
module.exports = {
|
|
462
|
-
// Standard MJ config
|
|
463
|
-
databaseSettings: { ... },
|
|
464
|
-
|
|
465
|
-
// Testing framework config
|
|
466
|
-
testing: {
|
|
467
|
-
defaultEnvironment: 'dev',
|
|
468
|
-
defaultFormat: 'console',
|
|
469
|
-
failFast: false,
|
|
470
|
-
parallel: false,
|
|
471
|
-
maxParallelTests: 5,
|
|
472
|
-
timeout: 300000 // 5 minutes
|
|
473
|
-
}
|
|
474
|
-
};
|
|
475
|
-
```
|
|
152
|
+
The CLI uses `cosmiconfig` to load configuration from:
|
|
476
153
|
|
|
477
|
-
|
|
154
|
+
- `.mjtestrc`
|
|
155
|
+
- `.mjtestrc.json`
|
|
156
|
+
- `mj.config.cjs` (in the `testing` section)
|
|
478
157
|
|
|
479
|
-
|
|
158
|
+
Configuration includes database connection settings for the MJ Provider.
|
|
480
159
|
|
|
481
|
-
|
|
482
|
-
✗ Error: Test 'complex-aggregation' failed validation
|
|
160
|
+
## Utilities
|
|
483
161
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
162
|
+
| Utility | Description |
|
|
163
|
+
|---------|-------------|
|
|
164
|
+
| `ConfigLoader` | Loads CLI configuration via cosmiconfig |
|
|
165
|
+
| `OutputFormatter` | Formats test results for terminal display with chalk |
|
|
166
|
+
| `SpinnerManager` | Manages ora spinners for long-running operations |
|
|
167
|
+
| `VariableParser` | Parses `--var key=value` CLI arguments into typed variables |
|
|
168
|
+
| `MJProvider` | Initializes the MemberJunction SQL Server data provider |
|
|
487
169
|
|
|
488
|
-
|
|
489
|
-
1. Create rubric 'component-quality-v2' or update test config
|
|
490
|
-
2. Add schema-validate oracle to test configuration
|
|
170
|
+
## Dependencies
|
|
491
171
|
|
|
492
|
-
|
|
493
|
-
|
|
172
|
+
| Package | Purpose |
|
|
173
|
+
|---------|---------|
|
|
174
|
+
| `@memberjunction/testing-engine` | Test execution engine |
|
|
175
|
+
| `@memberjunction/testing-engine-base` | Metadata and types |
|
|
176
|
+
| `@memberjunction/core` | Core MJ functionality |
|
|
177
|
+
| `@memberjunction/core-entities` | Entity types |
|
|
178
|
+
| `@memberjunction/sqlserver-dataprovider` | Database connectivity |
|
|
179
|
+
| `@oclif/core` | CLI framework |
|
|
180
|
+
| `chalk` | Terminal styling |
|
|
181
|
+
| `ora-classic` | Terminal spinners |
|
|
182
|
+
| `cosmiconfig` | Configuration loading |
|
|
494
183
|
|
|
495
|
-
##
|
|
184
|
+
## License
|
|
496
185
|
|
|
497
|
-
|
|
498
|
-
- [ ] Watch mode (re-run on file changes)
|
|
499
|
-
- [ ] Test coverage reports
|
|
500
|
-
- [ ] Parallel suite execution
|
|
501
|
-
- [ ] Result streaming for long-running tests
|
|
502
|
-
- [ ] Integration with MJ UI for clickable trace links
|
|
186
|
+
ISC
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/testing-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"description": "MemberJunction Testing Framework CLI - Command-line interface for test execution and management",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -21,12 +21,12 @@
|
|
|
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.
|
|
27
|
-
"@memberjunction/testing-engine": "4.
|
|
28
|
-
"@memberjunction/testing-engine-base": "4.
|
|
29
|
-
"@memberjunction/sqlserver-dataprovider": "4.
|
|
24
|
+
"@memberjunction/global": "4.1.0",
|
|
25
|
+
"@memberjunction/core": "4.1.0",
|
|
26
|
+
"@memberjunction/core-entities": "4.1.0",
|
|
27
|
+
"@memberjunction/testing-engine": "4.1.0",
|
|
28
|
+
"@memberjunction/testing-engine-base": "4.1.0",
|
|
29
|
+
"@memberjunction/sqlserver-dataprovider": "4.1.0",
|
|
30
30
|
"@oclif/core": "^3.27.0",
|
|
31
31
|
"ora-classic": "^5.4.2",
|
|
32
32
|
"chalk": "^5.6.2",
|