Closed ErikSchierboom closed 1 year ago
Here my suggestion what we could do here:
By default, we assume that there is one func TestSomething(t *testing.T) {...}
block for each task and that they appear in the order in which the tasks appear. We already have the test results in order and we can find out which parent test name each one has. There, we could easily number things. Everything with the first parent test name that appears in the list gets task id 1, next one gets 2 etc.
With that, we could handle like 80% of the cases (gut feeling) already without changing a single thing in the test files of the exercises.
Then for special concept exercises that have more test cases than tasks, we can allow adding the task id to the test manually. An example where we need this is https://github.com/exercism/go/blob/main/exercises/concept/bird-watcher/bird_watcher_test.go#L108
I am proposing to use a simple comment to add the task ID for a test. The pattern should be easy enough to check for and I can't think of a case where there would be other comments containing the same text so we would confuse things.
// TaskID 3
func TestFixBirdCount(t *testing.T) {
// ...
}
@exercism/go Any thoughts on this?
If possible, this test runner should be updated to version 3 of the test runner interface specification. In version 3, one additional feature is enabled: the ability to link individual tests to tasks. This allows the website to show which tests belong to which tasks.
The way tests are linked to tasks is via an (optional)
task_id
field, which is an integer that matches the number of the task as defined in the exercise'sinstructions.md
file (note: the instructions start at index 1).This is an example of a test in the
results.json
file:You are completely free in how to implement this. Some options are:
.meta/config.json
file)Let me know if there are any questions.