Library › Coding AI › Marketing and content
Write test cases for an AI-built discount code box
- For Marketing and content
- You practice Keeping the AI to your sources
- Time about 5 minutes
About this exercise
Your AI-built shop has a new discount code box for the spring campaign. Write exactly 5 numbered test cases, each 'Code: ... | Cart: $... | Expect: ...', one for each code or rule in the campaign sheet, using the current rules after the change. Plain text, no code blocks, under 140 words.
Common mistakes when you ask AI for this
- Testing the old minimum. The sheet says $40, and the AI tests against it. Try: Add: "SPRING15 minimum is $50 now (Bea's note)."
- Vague expectations. The AI writes 'should show an error' instead of the exact message. Try: Add: "Expect the exact message from the sheet."
- Testing features not in the release. The AI tests stacking codes because it's on the wishlist. Try: Add: "No stacking tests."
- Test code or a table. The AI writes automated tests or a markdown table. Try: Show it: "1. Code: SPRING15 | Cart: $60 | Expect: Code applied!" Plain text.
What a strong prompt includes
- Shows the test shape
- Uses the new minimum
- Asks for exact messages
- Sets the count
- Caps the length
Related exercises
- Accept a job offer and confirm the exact terms (Writing AI · Job seekers)
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)