{"id":20079018,"url":"https://github.com/emanuelnlopez/flutter-testing-course","last_synced_at":"2026-05-12T14:37:35.779Z","repository":{"id":184182143,"uuid":"498885092","full_name":"emanuelnlopez/flutter-testing-course","owner":"emanuelnlopez","description":"a couple of Flutter applications developed as part of a testing course","archived":false,"fork":false,"pushed_at":"2022-06-09T19:44:08.000Z","size":747,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T01:12:12.078Z","etag":null,"topics":["flutter","integration-tests","tdd","testing","unit-tests","widget-tests"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emanuelnlopez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-06-01T20:14:17.000Z","updated_at":"2022-06-09T20:47:56.000Z","dependencies_parsed_at":"2023-07-27T11:48:41.726Z","dependency_job_id":null,"html_url":"https://github.com/emanuelnlopez/flutter-testing-course","commit_stats":null,"previous_names":["emanuelnlopez/flutter-testing-course"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelnlopez%2Fflutter-testing-course","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelnlopez%2Fflutter-testing-course/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelnlopez%2Fflutter-testing-course/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emanuelnlopez%2Fflutter-testing-course/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emanuelnlopez","download_url":"https://codeload.github.com/emanuelnlopez/flutter-testing-course/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241509659,"owners_count":19974071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flutter","integration-tests","tdd","testing","unit-tests","widget-tests"],"created_at":"2024-11-13T15:19:29.396Z","updated_at":"2026-05-12T14:37:35.738Z","avatar_url":"https://github.com/emanuelnlopez.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter-testing-course\n\nApplication developed while doing the [Flutter testing course](https://www.udemy.com/course/flutter-testing-unit-widget-integration-testing) by [Richa HarSivo](https://harsivo.com/) on Udemy.\n\n## Notes\n\n### Flutter Testing\n\n- Automated test written by developers to ensure app performs correctly before you publish it.\n- The more test you write, the more stronge, robust and bug free your code becomes.\n\n#### Why write tests?\n\n- ***I’m paid to write code, not tests**.* A good programmer writes a clean and testable coce which is not possible without writing tests.\n- ***I have tight deadlines***. Once you learn how to write tests, it makes development moves faster.\n- ***We already have testers, why do we need to write tests?*** Testers don’t know the code better than developers. You can safeguard your code from any edge cases.\n- Clean Code = Testable Code\n- Testing ←→Bullet Proof Jacket\n\n#### Testing Pyramid\n\n- Unit Testing: Testing a unit of your program, like testing a function, a method, a class\n- Widget Testing: To make sure this widgets are error free.\n- Integration Testing: Covers a large part of your application, testing a flow (ie: login flow)\n\n#### Testing Structure AAA\n\nwe follow this structure no matter if we are writing a Unit Test, a Widget Test or a Integration Test\n\n- Arrange: Provide the input for the function or method we want to test\n- Act: Perform, call the function or method we want to test\n- Assert: We use the expect method. Check if the result received is the same as the spected value.\n\n#### TDD: Test Driven Development Life Cycle\n\n\u003cimg width=\"250\" src=\"extras/tdd_lifecycle.png\"\u003e\n\n- In TDD we write our test before writing any functionality\n- Functionality Driven Development: We have a requirement and we start working towards that requirement. We write our code driven to that functionality.\n- in TDD we write the failing test for the functionality first, then we make the test pass by writing the functionality. Finally we refactor our code.\n\n#### Unit Testing\n\n- We need to test a unit of our code (a functionality, afunction, a class, enum, etc)\n- There are certain rules to make sure we are writing good unit tests:\n    - Tests should be independent of each other.\n    - There should not be any implementation logic in unit test. Because that’s what we are testing.\n    - Test should be simple, fast, clean and readable. It should not depend on any network call or any other task on some other thread (create mocks for that scenario)\n\n#### How to write a unit test?\n\n```dart\nvoid main() {\n\ttest('Write complete description of the test', () {\n\t\t// Arrange\n\n\t\t// Act\n\n\t\t// Assert\n\n\t});\n}\n```\n\n- Filename must end with `_test`\n- To make a function testable you have to inject all its dependencies (never hardcode any dependency inside the function)\n- The function becomes reusable and we can test it\n\n#### Widget Testing\n\nIn Flutter everything is a widget, so let’s write test for widgets as well!\n\n- Test should be independent\n- There should not be creating any new widget\n- Test should be simple, fast, clean \u0026 readable\n\n#### Integration Testing\n\n- Tests the complete flow of your app\n- Unit tests tests a single unit and widget tests tests a single widget in your app\n- To test how those units work together, you should white integration tests\n- Mockito: `flutter pub run build_runner build`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelnlopez%2Fflutter-testing-course","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femanuelnlopez%2Fflutter-testing-course","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femanuelnlopez%2Fflutter-testing-course/lists"}