Unit Testing with Clean Architecture in Flutter | Mockito
A new Flutter project with Clean Architecture to fetch thw New Work Time Articles, display article details, and see more about details from url.
- Flutter SDK
- Android Studio or VS Code
- Dart plugin for your IDE
- Clone the repository
git clone https://github.com/YAMMEN98/ny-times-flutter-app.git
- Open the project in Android Studio or VS Code.
- Run the app on an emulator or physical device.
- Get all ny times articles.
- Search articles.
- Filter article by
period
- Display article details.
- Apply Dark/Light theme.
- Apply localization en/ar languages.
- View Image And Zoom It.
- Create a lane to generate apk automatically when upload code to the main branch.
- Apply Unit Testing .
- Flutter - The framework used).
- The New Work a Times API - API used for weather data.
To run test you should follow the steps:
- run command
flutter test
- If you want to get coverage file from Unit Test run this.command
flutter test --coverage
There is many tools to generate text coverage, we will use test_cov_console to generate coverage report, follow these steps to run it:
- Run the following command to make sure all flutter library is up-to-date
flutter pub get
,-
Run the following command to generate lcov.info on coverage directory
flutter test --coverage
, -
Run the tool to generate report from lcov.info to the console
flutter pub run test_cov_console
, -
You can follow and see more of parameters in test_cov_console.
-
You Can Output report to CSV file (-c, --csv, -o, --output) by
flutter pub run test_cov_console -c --output=coverage/test_coverage.csv
-
Open CSV file by excel and you will see like this result:
-
Yamen Abdullrahman - Senior Flutter Developer;