Enterprise DNAEnterprise DNA
← Directory home

Learn by doing · 10 minutes

Give a coding assistant a testable change

Learn to define observable behaviour before asking a tool to write code.

Start with this example

Write percentageChange(before, after).
100 → 125 = 25
100 → 80 = -20
0 → 10 = an explicit error

Give your assistant a clear brief

Use a compatible tool you already have, or choose a reviewed guide below. This is a suggested learning exercise, not proof that a specific installation has been tested.

In a disposable project, write a percentageChange(before, after) function with tests. Return the percentage increase or decrease as a number. 100 to 125 must return 25; 100 to 80 must return -20. Reject a zero starting value with an explicit error. Run the tests and show the results. Do not add dependencies unless required.

Check the result

Read the tests and run them yourself. Confirm that the zero case fails explicitly rather than returning Infinity. A tool saying “tests pass” without runnable tests is not the result.

What to take away

Acceptance examples narrow the task and make the result independently checkable.

Tools to understand next