Unit Testing in Scheme


I put together a mini-lecture on unit testing in Scheme for my CS330 class. It's not a complete introduction, just a tutorial on getting started. If you have suggestions on using SchemeUnit, I'd love to hear them.

Students in CS330 submit their assignments to an autograder. They sometimes try to use the autograder as a test harness with bad results.

I think there are some distinct advantages to students using unit testing in preparing their assignments:

  • Unit tests separate tests from the code. It's cleaner and easier to manage.
  • They can write tests before they code. This forces them to think about the functionality and boundary conditions before they begin
  • Tests are easier to share. Unless the assignment were specifically about testing, I encourage students to share their tests for assignments as an aid to communal understanding of the problem.

On the last point, while I'm happy to have them share tests, I don't want to provide them. I want them to get experience in writing tests. Discussing tests with other students is a great way for them to learn.