api-test-script-builder — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited api-test-script-builder (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Generate complete, runnable API test scripts from any input in your preferred framework.
curl -X POST https://api.example.com/login -d '{"email":"..."}'| Framework | Best For | Output File |
|---|---|---|
| Python pytest | CI/CD pipelines, backend QA | test_api.py + .env.example |
| Postman Collection | Manual + automated testing, team sharing | collection.json |
| JavaScript Jest | Frontend / Node.js teams | api.test.js + .env.example |
Default: Python pytest — most portable, works in any CI/CD pipeline.
Extract for each endpoint:
{id})If details are missing, make sensible assumptions and document them as comments in the code.
| Test Type | Description |
|---|---|
| ✅ Happy Path | Valid request → expected 2xx + correct response shape |
| ❌ Invalid Input | Missing/wrong fields → 400/422 |
| 🔐 Unauthorized | No/invalid/expired token → 401 |
| 🚫 Forbidden | Valid token, insufficient permissions → 403 |
| 🔍 Not Found | Non-existent ID or resource → 404 |
| 🔲 Boundary | Empty string, null, very long values, special characters |
| 📋 Schema Check | Response fields exist and have correct types |
#### Python pytest (test_api.py + .env.example)
Key rules:
BASE_URL and AUTH_TOKEN read from environment variables — never hardcoded in testspytest.fixture for shared setup (headers, auth token)response.json() only after asserting status_code — avoids misleading errors@pytest.mark.xfail where appropriate@pytest.mark.parametrizeStructure:
"""
API Tests: <Service Name>
Base URL: <base_url>
Setup:
pip install pytest requests python-dotenv
cp .env.example .env # fill in your values
Run: pytest test_api.py -v
"""
import os
import pytest
import requests
from dotenv import load_dotenv
load_dotenv()
BASE_URL = os.getenv("BASE_URL", "https://api.example.com")
AUTH_TOKEN = os.getenv("AUTH_TOKEN", "")
HEADERS = {"Content-Type": "application/json", "Authorization": f"Bearer {AUTH_TOKEN}"}
class TestLoginEndpoint:
"""POST /auth/login"""
def test_login_success(self):
payload = {"email": "[email protected]", "password": "ValidPass123"}
r = requests.post(f"{BASE_URL}/auth/login", json=payload)
assert r.status_code == 200
data = r.json()
assert "token" in data
assert isinstance(data["token"], str)
assert len(data["token"]) > 0
def test_login_wrong_password(self):
r = requests.post(f"{BASE_URL}/auth/login",
json={"email": "[email protected]", "password": "wrong"})
assert r.status_code == 401
def test_login_missing_email(self):
r = requests.post(f"{BASE_URL}/auth/login", json={"password": "ValidPass123"})
assert r.status_code in [400, 422]
def test_login_empty_body(self):
r = requests.post(f"{BASE_URL}/auth/login", json={})
assert r.status_code in [400, 422]
def test_login_invalid_email_format(self):
r = requests.post(f"{BASE_URL}/auth/login",
json={"email": "notanemail", "password": "ValidPass123"})
assert r.status_code in [400, 422]
def test_login_no_auth_header(self):
# Endpoint itself doesn't require auth, but confirms endpoint is reachable
r = requests.post(f"{BASE_URL}/auth/login", json={})
assert r.status_code != 500 # Should never return a server error.env.example:
BASE_URL=https://api.example.com
AUTH_TOKEN=your-token-here#### Postman Collection (collection.json)
Generate valid Postman Collection v2.1 JSON with:
Tests tab with pm.test(...) assertions for status code + response fields{{base_url}}, {{auth_token}} — never hardcoded URLs#### JavaScript Jest (api.test.js + .env.example)
Key rules:
axios with try/catch — axios throws on 4xx/5xx, so catch and assert error.response.statusprocess.env via dotenvdescribe block per endpointbeforeAll for any auth setup (e.g. login to get token)Structure:
/**
* API Tests: <Service Name>
* Setup: npm install jest axios dotenv
* Run: npx jest api.test.js --verbose
*/
require('dotenv').config();
const axios = require('axios');
const BASE_URL = process.env.BASE_URL || 'https://api.example.com';
const AUTH_TOKEN = process.env.AUTH_TOKEN || '';
const headers = { Authorization: `Bearer ${AUTH_TOKEN}`, 'Content-Type': 'application/json' };
describe('POST /auth/login', () => {
test('200 + token for valid credentials', async () => {
const res = await axios.post(`${BASE_URL}/auth/login`,
{ email: '[email protected]', password: 'ValidPass123' });
expect(res.status).toBe(200);
expect(res.data).toHaveProperty('token');
expect(typeof res.data.token).toBe('string');
});
test('401 for wrong password', async () => {
await expect(
axios.post(`${BASE_URL}/auth/login`, { email: '[email protected]', password: 'wrong' })
).rejects.toMatchObject({ response: { status: 401 } });
});
test('400/422 for missing fields', async () => {
await expect(
axios.post(`${BASE_URL}/auth/login`, {})
).rejects.toSatisfy(e => [400, 422].includes(e.response?.status));
});
});/mnt/user-data/outputs/present_files to deliver| Auth Type | How to implement |
|---|---|
| Bearer token | Authorization: Bearer {{token}} header |
| API key (header) | X-API-Key: {{api_key}} header |
| API key (query) | ?api_key={{api_key}} appended to URL |
| Basic auth | Authorization: Basic base64(user:pass) |
| OAuth2 | beforeAll login call → store token → inject into all requests |
| No auth | Confirm 401 is returned when auth header is added unexpectedly |
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.