I've been introducing students to racket using slideshow (based roughly
on the Quick tutorial), and we just started talking about
rackunit. Naturally the question of how to test slideshow programs came
up. I'm not sure of the best way to do it, but one way that works is
I think that depends on what you actually want to test.
For me your example looks more like a test that picts are equivalent values and that applymap and serialize seem to be working.
If for example circle would produce a triangle that test would still not fail, so maybe a test that actually compares with a bitmap image would be more reliable?
The problem with things like that is, that there often can be slight differences in how images are rendered, so that then creates the question: how do you actually compare the generated with the reference image and is there some threshold of allowed difference?
(For example font rendering is often different on different platforms)
Sorry, that I only have more questions instead of some nice solution...
I think at some point you just have to consider it from a cost/benefit standpoint and think about what kinds of tests could help you find bugs and whether that is likely to help you more, than it costs you to create the tests. While I like testing, I don't think everything is easily testable and always worth the effort.
Another thing to consider are these unit tests or integration tests?
But this seems to "circle" back around to what is the intent of the test?
I didn't really realize that this was about creating tests for student provided solutions.
Similar to coding practice websites and (I guess class room exercises).
I was more thinking along the lines, how would you detect errors in the slide implementation itself.
At least for this year switching is not practical. In general I don't
think teaching languages are a good fit for this particular course
(survey of programming languaes), but that's a topic for a different
thread.