Learn Test-Driven Development With Mocha
Learners will practice test driven development to create their own JavaScript testing suite using Mocha.js.
StartLearn TDD With Mocha
Lesson 1 of 1
- 1Test-driven development (TDD) is a programming technique where you write test code before implementation code. Test code is written to define the desired behavior of your program. The test output …
- 2When we use the red, green, refactor cycle, we: 1. Write test code that fails 2. Write implementation code to make the test pass 3. Consider refactoring the code As you learn TDD, it may feel back…
- 3#### Congrats you’re in the red! The red error messages describe the failures of our implementation code, so we can specifically address each issue that is preventing our test from passing. Let’…
- 4#### Congrats you’re in the green! Once all your tests pass, you can confidently refactor your code — restructure and improve it without changing its external behavior. The confidence come…
- 5Congratulations, you have made it through your first red-green-refactor cycle using TDD! The next step is to repeat this cycle to build a more complete implementation of the .initials method. Once…
- 6Now that we have tests that cover more than one condition, it is time to program the actual behavior that we want our .initials method to execute. Let’s think about the current state of Phrase.ini…
- 7Congrats, you’re back in the green! Which means the next step is to refactor the code so that your tests are fast, complete, reliable, isolated, maintainable, and expressive. Also, you want to mak…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory