Description
In this course, you will :
- Understand unit and integration testing.
- Learn more about OTP testing.
- Recognize the EXUnit.
- Understand the role of generators in property-based testing.
- Learn how to test ecto schemas and ecto queries.
Syllabus :
1. Unit Tests
- Introduction to Unit Tests
- Our First Test
- The Anatomy of a Test
- Organizing Our Tests using Describe
- Organizing Our Tests using Setup Blocks
- Creating Comprehensive Test Coverage
- List Comprehensions
- Further Usage of List Comprehension for Test Coverage
- Quiz on Basics of ExUnit
- Error CasesTesting Pure Functions
- Refactoring Toward Pure FunctionsIsolating Code
- Finer Control over Dependency Injection
2. Integration and End-to-End Tests
- Introduction to Integration Tests
- Testing Against Real External Dependencies
- Dependency Doubles
- BehaviorsTest Doubles: Stubs, Mocks, and Fakes
- Creating Stubs
- Creating MocksStubbing Entire Interfaces
- Quiz on Integration Testing IImproving Performance at Compile Time
- The Hidden Benefits of Dependency Doubles
- Testing the Actual Interaction with Services
- Building an Ad-hoc HTTP Server
- Building New Test Servers Using Bypass
- Recording Requests with Cassettes
- Comparing Cassettes
- Final Remarks on Testing External ServicesEnd-to-end Tests
- Quiz on Integration Testing II
3. Testing OTP
- GenServerIsolating a Functional Core
- Controlling the Life Cycle of OTP Processes in Tests
- Testing Periodic Actions
- Black Box model in Testing Periodic Actions
- Singleton ResourcesTesting Resiliency
- Supervision Trees
4. Testing Ecto Schemas
- Introduction to Ecto
- Testing Schema through Ecto Changesets
- Refactoring Tests for Added Safety
- Refactoring Tests to Be Self-updating
- Extensions to Creating a Self-Updating Test
- Creating a Schema
- Case for Shared Test Code
- Data Validation
- Adding Database Interactions
- Application Integration with Database
- Schema Integration with Database
- Testing an Ecto Schema
- Testing Schema Integrations with Database
- Sandbox Mode
5. Testing Ecto Queries
- Creating a Factory
- Testing Create OperationTesting Read OperationTesting Update Operation
- Testing Delete Operation
6. Testing Phoenix
- JSON-based APIs
- Setup Block for Testing JSON-based APIs
- Error Test for JSON-based APIs
- Testing the Happy PathTesting for the Presence of Plugs
- Testing Server-rendered HTML Applications
- Testing the Happy Path for CreateTesting the Error Case for Create
- Testing the UserSocket
- Testing a Channel
7. Property-Based Testing
- Example-based Tests
- Randomness and Property-Based Testing
- Introducing stream_data Framework
- Data GenerationGeneration SizeMore on Generation Size
- Writing Properties
- MacrosShrinking
- Strategies for Designing Properties
- Smoke Testing
- Limits of Property-Based Testing
- Stateful Property-Based Testing