This tutorial will guide you through Test-Driven Development (TDD) using the Phoenix Framework, specifically focusing on creating a RESTful application with Ecto for database interaction. You’ll learn how to implement and test a REST API from scratch, using Phoenix’s built-in tools for writing, running, and automating tests.
DELIVERY CHANNEL
In person
EXPERTISE
Intermediate
DURATION
3 days of 8 hours (including breaks and lunch)
PREREQUISITES
- Basic Elixir
TRAINING OBJECTIVES
- Grasp the core principles of TDD and how to apply the Red-Green-Refactor cycle to guide the development process.
- Learn how TDD ensures code reliability, reduces bugs, and encourages better code design through incremental testing.
- Learn to build a RESTful API using the Phoenix Framework with Elixir.
- Implement key Phoenix components, including:
- Set up and manage database schema changes through migrations.
- Validate and cast incoming data before database insertion.
- Set up and configure routes to handle API requests.
- Manage incoming requests, apply business logic, and return responses.
- Render API responses in JSON.
- Apply Atomic Design Methodology for structuring views and templates to promote reusable components.
- Use ExUnit testing framework, to write unit and integration tests.
- Test Phoenix endpoints to ensure the REST API works as expected.
- Write tests for CRUD operations (Create, Read, Update, Delete) and validate the correct handling of HTTP requests and responses.
- Ensure that Ecto and Phoenix components are well-tested before deployment to catch errors early and prevent regressions.
By the end of the tutorial, participants will be able to confidently build, test, and deploy a RESTful Phoenix application, ensuring both high code quality and correct API functionality through test-driven design.