Updated for Fall 2026
This activity is part of Milestone 1 — see that page for the milestone’s deliverables, rubric, and deadlines.
Writing Tests With and Without AI
Milestone 1 is where you start writing real tests, so it is also where we look at what AI is and isn’t good for in testing. You’ll do this in three stages, in order. The order is the point: you cannot evaluate generated tests until you have written a few yourself.
This is an individual activity. Complete it in your individual repository, after you have integrated your team’s work from the Testing Workshop. Your teammates are doing the same thing separately — you will compare notes at the end, not divide the work.
The natural scope is the Make Recipe functionality you are already required to test for Milestone 1. Note that MakeRecipe has a service and a controller but no repository, so use Recipe or Inventory for the persistence-layer test.
Stage 1: Write Tests Unaided
Do not use AI for this stage. Working from the requirements, write:
- service-layer tests for each method
- API-layer test for each method
- three system tests, executed by hand against the running application
Your MakeRecipeService and MakeRecipeController tests are the natural home for the service and API tests, since Milestone 1 requires them anyway.
For each one, decide what you are testing and why before you write it. Note how long the three automated tests took you — you will want that number in Stage 2.
Stage 2: Generate Tests From the Requirements
Now bring in your AI assistant. Give it the requirements — not the existing tests — and ask it to produce tests for functionality the requirements describe. Anchoring on the requirements rather than the code matters: if you point it at the implementation, it will write tests that assert whatever the code already does, including the bugs.
Here is Use Case 6 (Make Recipe) from our requirements:
<paste the use case, including alternative flows>
Write JUnit tests for the service layer that verify this requirement.
Do not look at the existing implementation -- test what the requirement
says should happen.
If you are not using AI, write a second set of tests from the requirements yourself and continue with the activity below — the evaluation step is the same.
Then evaluate what you get back. Run the tests and sort them into four piles:
- Passes, and tests something real. Keep it.
- Passes, but is redundant with a test you already have, or asserts something trivially true. Discard it.
- Fails because the test is wrong — it misreads the requirement, or calls an API that doesn’t exist. Discard it, and note what it got wrong.
- Fails because the implementation is wrong. This is the interesting pile. Carry it into Stage 3.
Check your coverage before and after adding the tests you kept. A large jump in coverage with no new bugs found is worth thinking about — it means the tests are exercising code without checking much.
Stage 3: Identify Ambiguities
That fourth pile exists because generated tests encode a literal reading of the requirements, while the implementation encodes somebody’s interpretation of them. Where the two disagree, one of three things is true:
- The implementation has a bug.
- The requirement is ambiguous, and the developer chose an implementation that you didn’t expect.
- The requirement is wrong or incomplete.
Telling these apart is requirements analysis, and it is a large part of what you’ll do in the Team Project.
Deliverable: identify at least three ambiguities or mismatches between the requirements and the implementation. For each, record:
- the requirement text and what the implementation actually does
- which of the three cases above you think it is, and why
- what question you would ask the product owner to resolve it
Create an issue in your individual repository for any you believe are genuine bugs. As with Milestone 0, you write these in your own words — the assistant helps you find candidates, not report them. You do not need to fix them.
Reflect
Record your reflection on this work in retros/retro-m1.md in your individual repository:
- Which prompts worked and which didn’t. Compare notes with your teammates afterwards — even if you all chose the same tool, you will have prompted it differently, and that difference is usually larger than the difference between tools.
- How the tests you wrote in Stage 1 compare to the generated ones — coverage, readability, whether they’d catch a regression.
- Where AI helped, where it wasted your time, and what you’ll do differently in Milestone 2.
Your retrospective should go beyond which tool you picked. More interesting questions: did having tests generated for you make you think less carefully about what needed testing? Did reviewing generated tests turn out to be faster or slower than writing them? Did it change what you noticed about the requirements?
Done Criteria
- One unaided test at each of the persistence, service, and API layers, plus three hand-executed system tests.
- Generated tests evaluated and the ones worth keeping merged.
- At least three documented requirement/implementation ambiguities, with an issue created for any you believe are genuine bugs.
retros/retro-m1.mdcompleted.
If you find bugs while writing automated tests, you do not need to fix them yet. But you do need to test the working functionality to achieve sufficient coverage!
