Teaching article

A program test case names the starting state and expected result

Specify the input, starting state and expected result.

Saying reach the goal leaves out much of the test. Record the input, position, heading and predicted outcome, then explain which feature the chosen case is meant to check and what it leaves untested.

Choose a case that checks a particular feature or boundary. Several purposeful cases are more informative than repeating one familiar successful route.

Give each test a purpose

Record the setup. Predict the trace. Compare execution.

A test naming only the goal omits how the robot starts.

Passing one test does not prove every case works.

What does this test cover? Provide a test-case template.

Resources

Further reading

Read next

Explore Coding and computational thinking. Browse all teaching articles.