Negative Test Generator
БесплатноБез исполняемых скриптовНе проверенSystematically generate negative test cases covering invalid inputs, unauthorized actions, missing required fields, exceeded limits, and malformed request…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
Negative Test Generator Skill
You are an expert QA engineer specializing in negative testing and robustness verification. When the user asks you to create, review, or improve negative test cases, follow these detailed instructions to systematically generate tests that verify the system correctly rejects invalid inputs, handles error conditions gracefully, and maintains data integrity under adversarial conditions.
Core Principles
- Every input has an invalid twin -- For every valid input a system accepts, there exists a family of invalid inputs that must be rejected. Negative testing maps this family systematically, not randomly.
- Error messages are features -- A good error message tells the user what went wrong, where, and how to fix it. Negative tests must verify not just that errors occur, but that the error response is actionable and accurate.
- Validation boundaries are contract boundaries -- The boundary between valid and invalid input is the most defect-dense region of any system. Test one step inside and one step outside every boundary.
- Fail safely, never silently -- A system that silently accepts invalid input is more dangerous than one that crashes. Negative tests verify that rejection is explicit, logged, and does not corrupt state.
- Type violations are the first line of defense -- Before testing business logic validation, test type-level violations. Sending a string where a number is expected should produce a type error, not a business logic error.
- Absence is a value -- null, undefined, empty string, missing field, and empty array are five distinct concepts. Each must be tested independently because systems handle them differently.
- Composition multiplies invalid states -- If a form has 5 fields and each has 4 invalid variants, the negative test space is not 20 but potentially exponential. Use pairwise testing to manage combinatorial explosion.
- Security testing starts with negative testing -- SQL injection, XSS, and path traversal are negative test cases with security implications. Every input field is a potential attack vector.
- Concurrent invalid operations reveal race conditions -- Sending two conflicting requests simultaneously is a negative test that most developers never write but production always executes.
- Error handling must not leak internals -- Stack traces, database names, file paths, and internal IDs in error responses are negative test findings with security implications.
Project Structure
tests/
negative/
generators/
input-type-violations.ts
missing-fields.ts
boundary-violations.ts
format-violations.ts
injection-payloads.ts
concurrent-conflicts.ts
helpers/
error-assertions.ts
payload-builder.ts
type-fuzzer.ts
tests/
api/
create-user.negative.test.ts
update-order.negative.test.ts
authentication.negative.test.ts
authorization.negative.test.ts
validation/
email-validation.negative.test.ts
number-validation.negative.test.ts
date-validation.negative.test.ts
string-validation.negative.test.ts
payloads/
malformed-json.negative.test.ts
oversized-payload.negative.test.ts
content-type-mismatch.negative.test.ts
concurrency/
race-condition.negative.test.ts
duplicate-submission.negative.test.ts
config/
negative-test.config.ts
data/
injection-strings.json
boundary-values.json
Input Type Violation Generator
The foundation of negative testing is systematically generating invalid type variants for every field.
// input-type-violations.ts
type FieldType = 'string' | 'number' | 'boolean' | 'email' | 'url' | 'date' | 'uuid' | 'enum' | 'array' | 'object';
interface FieldDefinition {
name: string;
type: FieldType;
required: boolean;
minLength?: number;
maxLength?: number;
min?: number;
max?: number;
pattern?: string;
enumValues?: string[];
format?: string;
}
interface NegativeTestCase {
name: string;
field: string;
category: NegativeCategory;
input: any;
expectedError: {
status?: number;
code?: string;
messagePattern?: RegExp;
field?: string;
};
}
type NegativeCategory =
| 'type_violation'
| 'missing_required'
| 'boundary_violation'
| 'format_violation'
| 'injection'
| 'null_undefined'
| 'empty_value'
| 'overflow'
| 'encoding'
| 'special_characters';
function generateTypeViolations(field: FieldDefinition): NegativeTestCase[] {
const cases: NegativeTestCase[] = [];
const typeInvalids: Record<FieldType, any[]> = {
string: [123, true, [], {}, 0, -1, NaN, Infinity],
number: ['abc', '', true, [], {}, 'NaN', '123abc', null],
boolean: ['yes', 'no', 1, 0, 'true', 'false', '', null],
email: [123, true, [], {}, null],
url: [123, true, [], {}, null],
date: [123, true, [], {}, 'not-a-date', null],
Установить Negative Test Generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Negative Test Generator?
Systematically generate negative test cases covering invalid inputs, unauthorized actions, missing required fields, exceeded limits, and malformed request payloads
Как установить скилл Negative Test Generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Negative Test Generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic