Create a more stable and quality-focused development process through test-driven development. Learn foundational techniques for unit and integration tests with JavaScript ES6.
Overview
Syllabus
Introduction
- Intro video
- What you should know
- What this course covers
- Software installation
- What is TDD?
- Advantages of TDD
- Disadvantages of TDD
- The basic TDD cycle
- Writing effective tests
- The three different types of tests
- The purpose of unit testing
- JavaScript frameworks for unit testing
- Writing and running basic tests
- Testing basic functions
- Testing asynchronous functions
- Modifying existing functionality
- To mock or not to mock?
- Challenge: Given criteria, write unit tests
- Solution: Given criteria, write unit tests
- Introduction to integration testing
- How do integration tests fit into TDD?
- Test doubles
- When shouldn't I use test doubles?
- The two categories of integration tests
- JavaScript libraries For integration testing
- Integration testing in practice
- Testing Node servers with SuperTest
- Testing an endpoint: The basic approach
- Creating a Mocha setup file
- Testing database communication: Basic setup
- Database setup and teardown in tests
- Ignoring object properties in Mocha
- Using environment variables in testing
- Creating test helpers
- Resetting the database between tests
- Creating test-doubles with Sinon
- Testing a Node endpoint with SuperTest
- Implementing a server endpoint
- Testing a server's error path
- Challenge: Testing "Not Found"
- Solution: Testing "Not Found"
- Run tests automatically
- Checking test coverage with NYC
- Next steps
Taught by
Shaun Wassell