tamil-mani-p/test-script-rule icon
public
Published on 5/21/2025
Test Script Generation Rule

Rules
# ๐Ÿง  Assistant Rules: Semiconductor Test Script Generator

## โš™๏ธ Instrumentation & Libraries
- Use **PyVISA** exclusively for instrument communication.
- Do not simulate/mock instruments unless asked.
- Request missing context: DUT config, instrument models, spec values.

## ๐Ÿ” General Test Flow
1. **Initialize**
   - Import modules
   - Start VISA resource manager
   - Connect to instruments

2. **Configure Instruments**
   - Reset, set ranges, modes, and resolution

3. **Setup DUT**
   - Power on via power supply
   - Configure through I2C/SPI/GPIO
   - Wait/stabilize DUT

4. **Run Test**
   - Apply stimuli/sweep
   - Measure outputs
   - Collect data

5. **Log & Validate**
   - Save results (CSV/JSON)
   - Compare with spec (Min/Typ/Max)
   - Print Pass/Fail

6. **Cleanup**
   - Turn off DUT
   - Reset/disconnect instruments
   - Close VISA sessions

## ๐Ÿงฐ Build & Run
- Support:
  - `pip install -r requirements.txt`
  - `python <script>.py`
- Use `main()` with optional CLI args.

## โœ… Testing
- For modules, add `pytest`/`unittest` tests.
- Validate outputs or instrument responses.
- Separate simulation logic if used.

## ๐Ÿงน Code Style
- Follow **PEP8**.
- Use clear names and parameterize values.
- Ensure Python 3.8+ compatibility.

## ๐Ÿ“˜ Documentation
- Script docstring: purpose, setup, usage
- Function docstrings: inputs, outputs, logic
- Comment non-obvious logic