Some background:
It’s common practice in many Exercism tracks to have all tests (except the first one) skipped.
This enables students to focus on the TDD approach: get one test to pass before working on the next one.
I’d like to apply this to the 8th track.
My proposal is to introduce RUN
and SKIP
words, so that a test suite might be transformed from
4 tests
"Black" ( "black" color-code ) 0 test_eq
"White" ( "white" color-code ) 9 test_eq
"Orange" ( "orange" color-code ) 3 test_eq
"Colors" ( colors ) ["black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"] test_eqa
end-of-tests
to
4 tests
RUN "Black" ( "black" color-code ) 0 test_eq
SKIP "White" ( "white" color-code ) 9 test_eq
SKIP "Orange" ( "orange" color-code ) 3 test_eq
SKIP "Colors" ( colors ) ["black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"] test_eqa
end-of-tests
The students can be instructed to change each SKIP
to RUN
one at a time to enable the tests.
The test status line will be updated to show how many tests were skipped:
$ 8th test.8th
test-words.8th
resistor-color.8th
resistor-color-tests.8th
Black ... OK
White ... SKIPPED
Orange ... SKIPPED
Colors ... SKIPPED
4 tests planned - 1 passed - 3 skipped - 0 failed
Additionally, an environment variable can be set to ignore the SKIP directives and run all the tests, without having to edit the test suite.
$ RUN_ALL_TESTS=true 8th test.8th
test-words.8th
resistor-color.8th
resistor-color-tests.8th
Black ... OK
White ... OK
Orange ... OK
Colors ... OK
4 tests planned - 4 passed - 0 skipped - 0 failed