TL;DR: The order of tests in an excercise is relevant, if students shall apply / understand Test First / Test Driven Development. Do we (want to) respect this in problem specifications?
I stumpled upon this question while working on minesweeper
. Here problem specification defines tests in an order that is inappropriate for TDD. In this exercise the 1-dimensional tests should come before any 2-dimensional test to support TDD well. But I did not find any hint, that the order in problem specifications is in any way related to the order the tests should be passed for TDD. And while discussing the test generators, the order of the tests also never was mentioned.
In many places, Excercism claims to follow “Test Driven Development”. Python even has a track document on the topic. I think, TDD is a good thing to learn. As TDD is a process, not a static thing, I would prefer to say “Test first” to what Exercism actually does. But let’s stick with TDD to name the goal.
Exercism also claims to focus on language fluency, not proficiency. And TDD is, as I understand it, an advanced topic of proficiency. But also very much language agnostic. So it is not the focus of Exercism to teach TDD, but it is the way of thinking we use to provide a learning experience. In other words: we need students to understand TDD at least in part to keep our focus on fluency in languages.
The audience of Exercism is: Students who are new to a language but not new to programming in general (I lack a link to a source that defines that. I know there is one…). As TDD is still not broadly adopted and far away from being a core component of “programming in general”, we can expect little knowledge about TDD in our audience. This is also seen in many threads in the forum, where people have no idea “where input comes from” or “what all these errors shall tell them”.
Students with little or no knowledge about TDD must put a lot of effort into understanding the TDD process on top of the effort to learn the language of choice. Many also are new to Exercism, which adds learning Exercism website usage. So we should reduce the effort of learning relevant TDD things as much as possible.
Students only really need to understand one part of TDD for Exercism: “Write a failing test, then make that pass”. This constant refinement process from general to specific tests and specific to general applicable production code is key to solving the exercises. But it is hard to grasp that step-by-step concept from what we present them.
This step by step refinement is nearly impossible to understand because we already have all tests written. The consequences of having all tests done are: Many tracks need to compile code, that at least has to have all required function signatures defined. And in general all tests are run and the result is a wall of failures.
It is advanced TDD knowledge to decide which one of all the failing tests should be made pass first. No student should make such a decision. Instead, the first test should be satisfied first. This would be easy to communicate, aligns to the idea of the “task id” for the syllabus and greatly improves usability of the test feedback.
There are languages / testing frameworks that could support the iterative refinement of TDD with all tests being written even better. E.g. PHPUnit can stop at the first failing test, so the wall of errors is avoided. That could help students to understand the process of TDD as a step-by-step guidance to their solution as much as possible.
But in the end, all possible improvement requires a sensible order of tests for TDD. Which we currently don’t have. We have a means of grouping by some theme (scenarios and titled cases
arrays), but these are in no way related to ordering. The only order we have is the order of test cases in the cases
arrays. And that is not meant to be an order for TDD.
Is there another mechanism I didn’t see yet? Should we try to have an order of tests for TDD?