84 lines
2.1 KiB
Markdown
84 lines
2.1 KiB
Markdown
# api.test
|
|
|
|
Test REST API endpoints by executing HTTP requests and validating responses against expected outcomes
|
|
|
|
## Overview
|
|
|
|
**Purpose:** Test REST API endpoints by executing HTTP requests and validating responses against expected outcomes
|
|
|
|
**Command:** `/api/test`
|
|
|
|
## Usage
|
|
|
|
### Basic Usage
|
|
|
|
```bash
|
|
python3 skills/api/test/api_test.py
|
|
```
|
|
|
|
### With Arguments
|
|
|
|
```bash
|
|
python3 skills/api/test/api_test.py \
|
|
--api_spec_path "value" \
|
|
--base_url "value" \
|
|
--test_scenarios_path_(optional) "value" \
|
|
--auth_config_path_(optional) "value" \
|
|
--output-format json
|
|
```
|
|
|
|
## Inputs
|
|
|
|
- **api_spec_path**
|
|
- **base_url**
|
|
- **test_scenarios_path (optional)**
|
|
- **auth_config_path (optional)**
|
|
|
|
## Outputs
|
|
|
|
- **test_results.json**
|
|
- **test_report.html**
|
|
|
|
## Artifact Metadata
|
|
|
|
### Produces
|
|
|
|
- `test-result`
|
|
- `test-report`
|
|
|
|
## Permissions
|
|
|
|
- `network:http`
|
|
- `filesystem:read`
|
|
- `filesystem:write`
|
|
|
|
## Implementation Notes
|
|
|
|
Support multiple HTTP methods: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS Test scenarios should validate: - Response status codes - Response headers - Response body structure and content - Response time/performance - Authentication/authorization - Error handling Features: - Load test scenarios from OpenAPI/Swagger specs - Support various authentication methods (Bearer, Basic, API Key, OAuth2) - Execute tests in sequence or parallel - Generate detailed HTML reports with pass/fail visualization - Support environment variables for configuration - Retry failed tests with exponential backoff - Collect performance metrics (response time, throughput) Output should include: - Total tests run - Passed/failed counts - Individual test results with request/response details - Performance statistics - Coverage metrics (% of endpoints tested)
|
|
|
|
## Integration
|
|
|
|
This skill can be used in agents by including it in `skills_available`:
|
|
|
|
```yaml
|
|
name: my.agent
|
|
skills_available:
|
|
- api.test
|
|
```
|
|
|
|
## Testing
|
|
|
|
Run tests with:
|
|
|
|
```bash
|
|
pytest skills/api/test/test_api_test.py -v
|
|
```
|
|
|
|
## Created By
|
|
|
|
This skill was generated by **meta.skill**, the skill creator meta-agent.
|
|
|
|
---
|
|
|
|
*Part of the Betty Framework*
|