CtrlK
BlogDocsLog inGet started
Tessl Logo

testland/negative-test-generator

Generates negative / error-path test cases that mirror happy-path tests - for each happy-path test, produces companions exercising input validation rejection, missing required fields, type mismatches, authorization failures, rate-limit errors, and adversarial payloads from the malicious-payload-bank. Emits cases as parameterized tests in the project's runner format. Use when a feature has happy-path coverage but the rejection / error / unauthorized paths are untested.

97

Quality

97%

Does it follow best practices?

Impact

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

negative-path-catalog.mdreferences/

Negative-path catalog

For each happy-path test of a request <verb> <path> with body fields <f1, f2, ...>, the negative-test set covers these categories.

1. Schema violations (validation rejection)

PatternTest
Missing required fieldSend the request without <f1>; expect 400 with <f1> named.
Wrong typeSend <f1> as wrong type (string where int expected); expect 400.
Out-of-range valueSend <f1> outside [min, max] per boundary-value-generator; expect 400.
Wrong enum valueSend <f1> with a value not in enum_values; expect 400.
Wrong formatString that fails the regex / format constraint; expect 400.
Extra unknown fieldSend field not in the schema; behavior depends on policy (strict reject vs. ignore).
Empty / null where forbiddenSend null or empty string for a non-nullable field.
Excess length / countSend string longer than max-length; collection larger than max-count.

2. Authentication failures

PatternTest
No Authorization headerExpect 401.
Expired tokenExpect 401 with token expired indication.
Malformed tokenExpect 401, no info leak about token shape.
Token from a different tenantExpect 401 / 403.

3. Authorization failures

PatternTest
User without permissionAuthenticated but role lacks required permission; expect 403.
Resource owned by another userRead/write attempt on someone else's resource (IDOR); expect 403 / 404.
Cross-tenant accessAttempt resource from another organization; expect 403 / 404.

4. Rate / quota failures

PatternTest
Burst exceeds rate limitSend N+1 requests in window; expect 429.
Plan quota exceededFree-tier user exceeds Free quota; expect 403 / 429 with quota info.

5. Conflict / state errors

PatternTest
Duplicate creationCreate same resource twice; expect 409.
Optimistic-lock conflictStale If-Match; expect 412.
State machine violationInvalid status transition (e.g. placed → completed skipping shipped); expect 422 / 409.

6. Adversarial inputs

Pull from malicious-payload-bank:

Field typePayload classes
Free-text inputXSS, SQLi, Unicode confusables
URL fieldSSRF, open-redirect
File upload namePath traversal
Search fieldReDoS, SQLi

Starter payloads per class (aligned with the OWASP Top 10 and CWE Top 25; the full catalog with encoded variants and per-context selection lives in malicious-payload-bank):

ClassStarter payloads
SQLi (CWE-89)' OR '1'='1' -- · '; DROP TABLE users; -- · admin'--
XSS (CWE-79)<script>alert(1)</script> · <img src=x onerror=alert(1)> · javascript:alert(1)
SSRF (CWE-918)http://169.254.169.254/latest/meta-data/ · http://localhost:6379/ · file:///etc/passwd
Path traversal (CWE-22)../etc/passwd · ..%2fetc%2fpasswd · ....//etc/passwd
ReDoS (CWE-1333)aaaaaaaaaaaaaaaaaaaaaaaa! (vs /^(a+)+$/) · aaaaaaaaaaaaaaaaaaaaaaaa@aaaaaa (vs typical email regexes)
Unicode confusablesаdmin (Cyrillic а U+0430) · gооgle.com · (ff ligature)

Assert reject (4xx) or escaped output - never that the payload merely "didn't crash".

7. Server errors (where applicable)

PatternTest
Upstream dependency unavailableMock the dependency to fail (per api-chaos-runner); expect 502 / 503 with retry hint.
TimeoutMock slow upstream; expect 504 / circuit-breaker fallback.

SKILL.md

tile.json