|
| 1 | +--- |
| 2 | +allowed-tools: Read, Write, Bash, Glob, Grep, Edit |
| 3 | +description: Create a new integration test case following the testcases/ pattern |
| 4 | +argument-hint: <test-name> <description> |
| 5 | +--- |
| 6 | + |
| 7 | +I'll help you create a new integration test case following the established pattern in the `testcases/` directory, similar to the `eval-input-overrides` example from PR #1101. |
| 8 | + |
| 9 | +## Understanding the Test Structure |
| 10 | + |
| 11 | +Based on the existing test pattern, each integration test should have: |
| 12 | +- `run.sh` - Main test execution script |
| 13 | +- `pyproject.toml` - Python dependencies |
| 14 | +- `entry-points.json` - Entry point configuration |
| 15 | +- `uipath.json` - UiPath configuration |
| 16 | +- `src/` directory containing: |
| 17 | + - Evaluation set JSON files |
| 18 | + - Input/configuration JSON files |
| 19 | + - `assert.py` - Validation script |
| 20 | + |
| 21 | +## Step 1: Gather Information |
| 22 | + |
| 23 | +I need to understand what you're testing. Please provide: |
| 24 | +1. **Test Name**: A descriptive name for your test (e.g., "eval-multimodal-inputs") |
| 25 | +2. **Test Purpose**: What feature or scenario are you testing? |
| 26 | +3. **Evaluation Set**: What evaluations will run? |
| 27 | +4. **Expected Behavior**: What should the test verify? |
| 28 | + |
| 29 | +Let me check the existing testcases structure: |
| 30 | + |
| 31 | +!ls -1 testcases/ |
| 32 | + |
| 33 | +## Step 2: Create Test Directory Structure |
| 34 | + |
| 35 | +Based on your test name `${test-name}`, I'll create: |
| 36 | + |
| 37 | +```bash |
| 38 | +testcases/${test-name}/ |
| 39 | +├── run.sh |
| 40 | +├── pyproject.toml |
| 41 | +├── entry-points.json |
| 42 | +├── uipath.json |
| 43 | +├── src/ |
| 44 | +│ ├── eval-set.json |
| 45 | +│ ├── config.json (if needed) |
| 46 | +│ └── assert.py |
| 47 | +``` |
| 48 | + |
| 49 | +Let me read the reference implementation to understand the pattern: |
| 50 | + |
| 51 | +!cat testcases/eval-input-overrides/run.sh |
| 52 | +!cat testcases/eval-input-overrides/pyproject.toml |
| 53 | +!cat testcases/eval-input-overrides/src/assert.py |
| 54 | + |
| 55 | +## Step 3: Create the Test Files |
| 56 | + |
| 57 | +I'll create each file following the established pattern: |
| 58 | + |
| 59 | +### 1. run.sh - Test Execution Script |
| 60 | +```bash |
| 61 | +#!/bin/bash |
| 62 | +set -e |
| 63 | + |
| 64 | +echo "Syncing dependencies..." |
| 65 | +uv sync |
| 66 | + |
| 67 | +echo "" |
| 68 | +echo "Running ${test-name} integration test..." |
| 69 | +echo "" |
| 70 | + |
| 71 | +# Create output directory |
| 72 | +mkdir -p __uipath |
| 73 | + |
| 74 | +# Run evaluations |
| 75 | +uv run uipath eval main src/eval-set.json \ |
| 76 | + --no-report \ |
| 77 | + --output-file __uipath/output.json |
| 78 | + |
| 79 | +echo "" |
| 80 | +echo "Test completed! Verifying results..." |
| 81 | +echo "" |
| 82 | + |
| 83 | +# Run assertion script to verify results |
| 84 | +uv run python src/assert.py |
| 85 | + |
| 86 | +echo "" |
| 87 | +echo "✅ ${test-name} integration test completed successfully!" |
| 88 | +``` |
| 89 | + |
| 90 | +### 2. pyproject.toml - Dependencies |
| 91 | +```toml |
| 92 | +[project] |
| 93 | +name = "${test-name}" |
| 94 | +version = "0.1.0" |
| 95 | +requires-python = ">=3.11" |
| 96 | +dependencies = [ |
| 97 | + "uipath>=2.4.0", |
| 98 | +] |
| 99 | + |
| 100 | +[build-system] |
| 101 | +requires = ["setuptools>=61.0"] |
| 102 | +build-backend = "setuptools.build_meta" |
| 103 | +``` |
| 104 | + |
| 105 | +### 3. entry-points.json - Entry Points Configuration |
| 106 | +```json |
| 107 | +{ |
| 108 | + "main": "src/main.json" |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +### 4. uipath.json - UiPath Configuration |
| 113 | +```json |
| 114 | +{ |
| 115 | + "name": "${test-name}", |
| 116 | + "version": "1.0.0" |
| 117 | +} |
| 118 | +``` |
| 119 | + |
| 120 | +### 5. src/eval-set.json - Evaluation Set |
| 121 | +(You'll need to provide the specific evaluation configuration) |
| 122 | + |
| 123 | +### 6. src/assert.py - Validation Script |
| 124 | +```python |
| 125 | +"""Assertions for ${test-name} testcase.""" |
| 126 | +import json |
| 127 | +import os |
| 128 | + |
| 129 | + |
| 130 | +def main() -> None: |
| 131 | + """Main assertion logic.""" |
| 132 | + output_file = "__uipath/output.json" |
| 133 | + |
| 134 | + assert os.path.isfile(output_file), ( |
| 135 | + f"Evaluation output file '{output_file}' not found" |
| 136 | + ) |
| 137 | + print(f"✓ Found evaluation output file: {output_file}") |
| 138 | + |
| 139 | + with open(output_file, "r", encoding="utf-8") as f: |
| 140 | + output_data = json.load(f) |
| 141 | + |
| 142 | + print("✓ Loaded evaluation output") |
| 143 | + |
| 144 | + # Add your specific assertions here |
| 145 | + assert "evaluationSetResults" in output_data |
| 146 | + |
| 147 | + evaluation_results = output_data["evaluationSetResults"] |
| 148 | + assert len(evaluation_results) > 0, "No evaluation results found" |
| 149 | + |
| 150 | + print(f"✓ Found {len(evaluation_results)} evaluation result(s)") |
| 151 | + |
| 152 | + # Add test-specific validations |
| 153 | + |
| 154 | + print("\\n✅ All assertions passed!") |
| 155 | + |
| 156 | + |
| 157 | +if __name__ == "__main__": |
| 158 | + main() |
| 159 | +``` |
| 160 | + |
| 161 | +## Step 4: Make run.sh Executable |
| 162 | + |
| 163 | +!chmod +x testcases/${test-name}/run.sh |
| 164 | + |
| 165 | +## Step 5: Test the Integration Test |
| 166 | + |
| 167 | +Let's validate the test runs correctly: |
| 168 | + |
| 169 | +!cd testcases/${test-name} && ./run.sh |
| 170 | + |
| 171 | +## Step 6: Add to Documentation |
| 172 | + |
| 173 | +Consider documenting your test in the project README or test documentation: |
| 174 | +- What scenario it tests |
| 175 | +- How to run it manually |
| 176 | +- What it validates |
| 177 | + |
| 178 | +--- |
| 179 | + |
| 180 | +## Summary |
| 181 | + |
| 182 | +Your new integration test `${test-name}` has been created following the established pattern: |
| 183 | + |
| 184 | +✅ **Directory Structure**: Matches testcases/ pattern |
| 185 | +✅ **Dependencies**: Configured in pyproject.toml |
| 186 | +✅ **Test Script**: run.sh with proper error handling |
| 187 | +✅ **Assertions**: Validation logic in assert.py |
| 188 | +✅ **Configuration**: UiPath and entry points configured |
| 189 | + |
| 190 | +## Next Steps |
| 191 | + |
| 192 | +1. **Customize** the eval-set.json with your specific test data |
| 193 | +2. **Update** assert.py with test-specific validations |
| 194 | +3. **Run** the test: `cd testcases/${test-name} && ./run.sh` |
| 195 | +4. **Document** the test purpose and usage |
| 196 | +5. **Commit** the new test to version control |
| 197 | + |
| 198 | +## Tips |
| 199 | + |
| 200 | +- Keep tests focused on a single feature or scenario |
| 201 | +- Use descriptive evaluation names in eval-set.json |
| 202 | +- Add clear assertion messages for debugging |
| 203 | +- Follow the echo statement pattern (removed from initial header, kept for progress) |
| 204 | +- Ensure all JSON files are properly formatted |
| 205 | + |
| 206 | +Need help customizing any specific part of the test? Just ask! |
0 commit comments