Unit-Test-Generator
Why this prompt matters
AI-generated tests catch edge cases developers often miss. The structured prompt ensures comprehensive coverage beyond just the happy path.
What we use it for
Testing
Prompt
Write unit tests for the following function. Cover: happy path, edge cases (empty input, null, boundary values), error conditions, and type edge cases. Use the testing framework appropriate for the language. Each test should have a descriptive name that explains what it tests.
Result
```typescript describe('calculateDiscount', () => { it('applies 10% discount for orders over $100', () => { expect(calculateDiscount(150)).toBe(135); }); it('returns original price for orders at exactly $100', () => { expect(calculateDiscount(100)).toBe(100); }); it('throws for negative amounts', () => { expect(() => calculateDiscount(-1)).toThrow('Invalid amount'); }); }); ```
Unit-Test-Generator
Erstellt umfassende Unit-Tests für Ihren Code mit guter Abdeckung.
Dieser KI-Prompt ist darauf ausgelegt, Ihnen die besten Ergebnisse zu liefern. Folgen Sie den Anweisungen und passen Sie die Parameter an Ihre spezifischen Bedürfnisse an.
Für die besten Ergebnisse geben Sie detaillierten Kontext an und spezifizieren Sie das gewünschte Ausgabeformat. Experimentieren Sie mit verschiedenen Variationen, um die beste für Ihren Anwendungsfall zu finden.