OpenAI & ChatGPT · Foto: Kevin Rheese, CC BY 2.0
Testing taste
Zuletzt aktualisiert:
Typ
Prompt
Lizenz
CC0-1.0 (Public Domain)
Anwendungsfeld
Prompt-Bibliothek
Voraussetzungen
Keine besonderen — direkt loslegen.
Legt Testkonventionen (vitest, msw, Testcontainers, echte Collaborators) als Stilvorgabe für KI-generierte Tests fest.
Der Prompt
# Testing taste of a pragmatic TypeScript team
- Use vitest as the default test runner for unit and integration tests. Confidence: 0.90
- Keep test files next to the code they cover as *.test.ts. Confidence: 0.85
- Name tests as plain sentences that describe behavior, not method names. Confidence: 0.90
- Follow arrange, act, assert with a blank line between each phase. Confidence: 0.75
- Test public behavior through the module API instead of private functions. Confidence: 0.90
- Prefer real collaborators and in-memory fakes over mocks. Confidence: 0.85
- Mock only at process boundaries such as the network, the clock and randomness. Confidence: 0.90
- Intercept HTTP with msw instead of stubbing fetch by hand. Confidence: 0.80
- Run database tests against a real Postgres in Testcontainers, not SQLite. Confidence: 0.80
- Freeze time with fake timers and pass seeds to anything random. Confidence: 0.90
- Build test data with small factory functions that accept overrides. Confidence: 0.85
- Keep snapshot tests rare and small, and review every snapshot diff. Confidence: 0.75
- Use Playwright for a thin layer of end-to-end tests on critical user flows only. Confidence: 0.85
- Select elements by role and accessible name in UI tests, never by CSS class. Confidence: 0.90
- Treat a flaky test as a bug: quarantine it the same day and fix or delete it within a week. Confidence: 0.85
- Never use sleep in tests; wait for an explicit condition instead. Confidence: 0.95
- Keep the full unit suite under one minute on a laptop. Confidence: 0.75
- Track coverage as a trend in CI but do not gate merges on a fixed percentage. Confidence: 0.70
- Add property-based tests with fast-check for parsers and pure logic. Confidence: 0.65
- Write a failing regression test before fixing every reported bug. Confidence: 0.90
- Run tests in random order to catch hidden shared state. Confidence: 0.70
So nutzt du es
Den Prompt-Text kopieren (Button oben) und als System-Prompt bzw. erste Nachricht in ChatGPT, Claude oder einem lokalen Modell einfügen. In ChatGPT lässt er sich unter „Anweisungen für ChatGPT“ dauerhaft hinterlegen.
Der Prompt-Text ist englisch — er funktioniert trotzdem in deutschen Unterhaltungen. Für deutsche Antworten einfach am Ende ergänzen: „Antworte auf Deutsch.“
Im Detail
Wie monorepo-taste ein Geschmacksprofil, hier für Testpraxis in einem pragmatischen TypeScript-Team: vitest als Standard-Runner, Tests als *.test.ts neben dem Code, sprechende Verhaltensbeschreibungen statt Methodennamen, Arrange-Act-Assert, echte Collaborators statt Mocks, msw für HTTP, Testcontainers für echtes Postgres statt SQLite, feste Zeit und Seeds für Zufall. Als System-Prompt steuert das KI-generierte Tests genau in diese Richtung, statt beliebiger Mock-Strukturen. Wertvoll für Teams, die diese Tool-Kombination bereits nutzen und ihre Teststandards nicht in jedem Prompt wiederholen wollen; für Teams mit Jest oder reiner Unit-Mock-Philosophie passt das Profil nur bedingt.
Praxis-Tipp
Fügen Sie den Prompt als System-Prompt ein, bevor Sie die KI einen Test für eine neue API-Route schreiben lassen — sie nutzt dann automatisch msw statt handgestrickter fetch-Stubs.
Siehe auch
Lizenz & Quelle
- Lizenz: CC0-1.0 (Public Domain)
- Quelle: awesome-chatgpt-prompts (GitHub)
So einfach geht’s
- 01
Anrufen oder schreiben
Anruf, WhatsApp oder Formular. Die Ersteinschätzung am Telefon ist kostenlos.
- 02
Termin oder Fernhilfe
Ich komme zu Ihnen oder helfe per Fernhilfe am Bildschirm. Den Kostenrahmen erfahren Sie, bevor ich anfange.
- 03
Erledigt, bezahlt wird danach
Es läuft, und Sie wissen, wie es geht. Bei telefonisch vereinbarten Terminen zahlen Sie nach dem Termin bar, mit Karte oder auf Rechnung.
Inhalt ansehen (testing-taste.txt)
Lade …
Erfahrungen & Kommentare.
Funktioniert der Prompt bei Ihnen? Tipps, Stolperfallen, Varianten — teilen Sie es mit der Community.
Lade Kommentare …
Passt dazu.
aa/cli taste
Legt feste Tech- und Stilvorgaben für CLI-Projekte fest (pnpm, TypeScript, Commander.js, klare Ordnerstruktur).
Accessibility Auditor
Lässt die KI als Accessibility-Experte auf WCAG-2.2- und Section-508-Konformität prüfen.
Act as a Senior Codebase Auditor & Tech Debt Refactorer
Lässt die KI wie ein Senior-Engineer Altcode auf toten Code, Duplikate und unnötige Komplexität prüfen.
