|
| 1 | +# Cases System |
| 2 | + |
| 3 | +This directory contains test cases, scenarios, and workflow definitions. |
| 4 | + |
| 5 | +## Structure |
| 6 | + |
| 7 | +- `scenarios/` - Test scenario definitions |
| 8 | +- `workflows/` - Workflow templates and definitions |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +Cases provide validation, testing, and automation: |
| 13 | +- Unit test scenarios |
| 14 | +- Integration test workflows |
| 15 | +- End-to-end test cases |
| 16 | +- Performance benchmarks |
| 17 | +- Validation scenarios |
| 18 | + |
| 19 | +## Example Scenario |
| 20 | + |
| 21 | +```javascript |
| 22 | +const { CoolProcessSystem } = require('../modules/coolprocess-system.js'); |
| 23 | +const coolProcess = new CoolProcessSystem(); |
| 24 | + |
| 25 | +// Create a test case |
| 26 | +coolProcess.createCase('data-validation', () => { |
| 27 | + const data = [1, 2, 3, 4, 5]; |
| 28 | + const sum = data.reduce((a, b) => a + b, 0); |
| 29 | + const expected = 15; |
| 30 | + |
| 31 | + return { |
| 32 | + success: sum === expected, |
| 33 | + actual: sum, |
| 34 | + expected: expected |
| 35 | + }; |
| 36 | +}); |
| 37 | + |
| 38 | +// Execute the case |
| 39 | +const result = coolProcess.executeCase('data-validation'); |
| 40 | +console.log(result.status); // 'passed' |
| 41 | +``` |
| 42 | + |
| 43 | +## Example Workflow |
| 44 | + |
| 45 | +```javascript |
| 46 | +// Create a multi-step workflow |
| 47 | +coolProcess.createWorkflow('data-pipeline', [ |
| 48 | + // Extract |
| 49 | + () => { |
| 50 | + return { data: [1, 2, 3, 4, 5] }; |
| 51 | + }, |
| 52 | + |
| 53 | + // Transform |
| 54 | + (input) => { |
| 55 | + return input.data.map(x => x * 2); |
| 56 | + }, |
| 57 | + |
| 58 | + // Load |
| 59 | + (transformed) => { |
| 60 | + coolProcess.storeInFloppies('result', transformed); |
| 61 | + return { success: true, count: transformed.length }; |
| 62 | + } |
| 63 | +]); |
| 64 | + |
| 65 | +// Execute workflow |
| 66 | +await coolProcess.executeWorkflow('data-pipeline'); |
| 67 | +``` |
| 68 | + |
| 69 | +## Case Types |
| 70 | + |
| 71 | +1. **Validation Cases** - Verify data integrity |
| 72 | +2. **Transformation Cases** - Test data transformations |
| 73 | +3. **Integration Cases** - Test system integrations |
| 74 | +4. **Performance Cases** - Benchmark performance |
| 75 | +5. **Workflow Cases** - Test complete workflows |
| 76 | + |
| 77 | +## Best Practices |
| 78 | + |
| 79 | +1. Use descriptive case names |
| 80 | +2. Include expected results |
| 81 | +3. Add error handling |
| 82 | +4. Document prerequisites |
| 83 | +5. Keep cases focused and simple |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +*Heavy work situation ready - organized cases from PR 832+833* |
0 commit comments