
Learn to apply test driven development with Flutter by building a small app using a fake HTTP server and mock API, exploring clean architecture, user endpoints, and Firebase testing.
Discover how Dart differentiates referential and value equality, and learn to override the equality operator and hashCode to implement value-based comparisons using Equatable.
Learn to implement value equality with Equatable, define an authentication repository contract, and use the dartz Either type to model server failures in clean architecture.
Learn how to stub and hijack dependencies in tests for a Dart and Flutter clean architecture setup, using then, then answer, and right/left in an asynchronous create user flow.
Act, then await the future, and assert the result. Verify the auth repositories create user method is invoked and the outcome equals a right void.
Demonstrate test-driven development with clean architecture by validating part 4 tests that verify the use case calls the president exactly once, with creator, name, and avatar, and no further interactions.
Learn to test the get_users use case by mocking the authentication repository and returning a list of users. Verify the repository get_users is called once and no extra interactions occur.
Learn to convert API exceptions into API failures, implement repository logic for get users, and drive development with tests that verify remote data source interactions and error handling.
Test the authentication remote data source implementation, validating success with 200/201 status codes and failures with proper exceptions, and add a dedicated dart test file using the http package.
Learn to throw an api exception for non-200 http responses and validate endpoint calls in a remote data source to pass tests and reach green phase.
Learn to write a cubit authentication test by mocking get users and create user use cases, wiring them into the cubit's setup and verifying the authentication initial state.
Learn to test a qubit using the block test package to mock the create user use case, set up dev dependencies, and verify emitted states creating user and user created.
Explore building a Flutter app with dependency injection, a bloc-like qubit using a service locator, and a home UI with add-user flow and loading states.
Create the first user in a Flutter app by adding a username input and a create user button, then save and show the new user (avatar included) in the list.
In this course, we will cover how to do test driven development. We will also build a dummy app to learn about it in depth. We will cover almost 100 tests which will involve api mock testing, firebase api mock testing, build correct http response, learn how to deal with incorrect or wrong response from the server.
What is Test Driven Development (TDD)?
In layman’s terms, Test Driven Development (TDD) is a software development practice that focuses on creating unit test cases before developing the actual code. It is an iterative approach combining programming, unit test creation, and refactoring.
The TDD approach originates from the Agile manifesto principles and Extreme programming.
As the name suggests, the test process drives software development.
Moreover, it’s a structuring practice that enables developers and testers to obtain optimized code that proves resilient in the long term.
In TDD, developers create small test cases for every feature based on their initial understanding. The primary intention of this technique is to modify or write new code only if the tests fail. This prevents duplication of test scripts.
Apart from that you will learn correct folder structure of your using BLoC and Provider with clean architecture aspect.
Throughout the testing we will use BLoC & Cubit and show how to manage states during testings.
We will cover how to use the flutter_test package and all the functions in like
1. test()
2. when()
3. expect()
4. verify()
5. verifyNoMoreInteractions()