Test-Driven Development Example
Explore the Test-Driven Development workflow by writing small failing tests before coding in Angular with Jasmine. Understand how to cycle through testing, coding, and refactoring to build features efficiently and maintain code quality through unit tests.
We'll cover the following...
We'll cover the following...
TDD workflow
Test-driven development (TDD) thrives on a fast feedback loop. As we build a new feature, we repeat a cycle of three steps:
-
Write a simple test that we know will fail.
-
Write just enough code to make the test pass.
-
While the tests are passing, refactor and tidy up our code.
The key is that our test should be small. It must test a single example or logic condition. And we should expect to write perhaps just a few lines of code to make the test pass.
This ...