Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Getting Started with Mocha and Chai 3:16
- General Structure of Test Files 4:10
- Setting Up Mocha 4 questions
- Installing Mocha 1 objective
- Installing Chai 1 objective
- Test Suites and Test Specs (describe and it) 3:34
- Mocha Chai Basics 4 questions
- Writing Our First Test Suite 14:49
- Writing Our First Test Suite - Part 2 8:15
- Challenge: Expanding Our Expectations 9:57
- Answer: Expanding Our Expectations 12:05
- A Testing Test! 1 objective
- Assert Your Knowledge 5 questions

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
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.
Resources
Video review
- Adding “_test” to your test file names makes finding them more easily
- Mocha’s representation of a test suite – the
describe
function – 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
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Brian Patterson
19,588 Points3 Answers
-
Daniel Nitu
13,272 Points2 Answers
-
Anthony c
20,907 PointsWhat about on the client-side where export/require aren't available?
Posted by Anthony cAnthony c
20,907 Points3 Answers
-
Alejandro Molina
3,997 Points6 Answers
-
Alejandro Molina
3,997 Points4 Answers
-
PLUS
d h
Courses Plus Student 527 Pointsquestion about line 9 on ship_methods.js of "Writing Our First Test Suite part 1 " video
Posted by d hd h
Courses Plus Student 527 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up