🎲
Eddie's CS 61B Guide
  • Homepage
  • Guides
    • Lab
      • Spring 2022
        • Lab 1
        • Lab 2
        • Lab 3
        • Lab 5
        • Lab 6
Powered by GitBook
On this page

Was this helpful?

  1. Guides
  2. Lab
  3. Spring 2022

Lab 6

Unit Testing and Acceptance Testing for Enigma

PreviousLab 5

Last updated 2 years ago

Was this helpful?

Lab spec:

Welcome to lab 6! As a reminder of project collaborations policies:

We highly encourage you to work with a partner to understand Enigma, Permutations, the existing testing methods and utilities, and brainstorming tests and edge cases. HOWEVER, if you are planning on using the tests you write in this lab in your project, you will need to do the actual code-writing by yourself, since code for projects (including tests) must be written by you alone as per our .

Testing

I'll be operating under the assumption that you already know how to write tests. If not, see the or !

My general approach to writing tests is to start small and work your way up to increasingly large and complex tests. This is what unit tests are great at! When writing tests, it's important to cover a large range of cases. The following list of what I like to check for is by no means comprehensive and can always be improved upon or added to.

  • A few simple cases to establish basic functionality

  • Any special cases involving 0, false, "", [], {}, and null

  • Any special cases involving 1, true, or objects with exactly one element

  • Any special cases involving the limitations (or intended limits) of the function

  • Any specific cases relevant to the function

    • For example, I would test that a prime number checker labels 2 as prime

  • Any cases where an error is expected, such as passing in an invalid type

https://inst.eecs.berkeley.edu/~cs61b/sp22/materials/lab/lab6/index.html
Project Collaboration Policy
lab spec
my lab 2 guide