It’s finally time to write the first tests for our Battleship game engine! In this video, we’ll start writing our BDD outline for Battleship. We’ll talk about describing the test suite, writing a test spec, and deciding test expectations.
- Adding “_test” to your test file names makes finding them more easily
- Mocha’s representation of a test suite – the
describefunction – takes two arguments: a string describing all the tests inside, and a function to wrap them all together
- A suite will break at first (that's OK), because the function you're referring to may not exist yet
- The hardest part about BDD is deciding how the function we haven’t written yet might actually work.
- Even without writing tests, programmers still do a lot of guesswork as they program --- it's rare that you know exactly how every part of a program works at first
You need to sign up for Treehouse in order to download course files.Sign up