The Counter App is a simple Flutter application that allows users to increment and decrement a counter value. It serves as a basic example for understanding Flutter app development and state management.
- Increment and decrement buttons for modifying the counter value.
- Display of the current counter value.
- Clone the repository:
git clone https://github.com/queendevelopers/flutter-counter-example-with-test.git
- Navigate to the project directory:
cd counter
- Install dependencies
flutter pub get
- Run the app flutter run
flutter run
- Run test
flutter test
- Run Integration test
flutter driver --target=test_driver/main_app.dart --driver=test_driver/main_app_test.dart
- Generate screenshot in target devices
TARGET_PLATFORM=ios flutter driver --target=test_driver/main_app.dart --driver=test_driver/main_app_test.dart
TARGET_PLATFORM=chrome flutter driver --target=test_driver/main_app.dart --driver=test_driver/main_app_test.dart -d chrome # Make sure to run webdriver first.
- main.dart: counter application
- counter.dart: increment and decrement method
- .vscode/launch.json: vscode launch configuration for application, unit test, widget test and integration test.
- test/unit/counter_test: unit test.
- test/wiget/counter_widget_test: widget & golden test
- test_driver: integration test and screenshot extension method.
- .github: configuration for codemagic.
- coverage: generated codecoverage from lcov.
- We have 100% code coverage for counter application (also demonstrates ignore file for main function). You can open code coverage page by using command on root for the project :
open coverage/html/index.html
- Codemagic setup is required to work the github continuos integration and deployment.
- If you manage to setup on your personal repo then check Run only test and Android. (iOS build won't work util you add certificates)
- Also, for flutter integration test arguments, you need to replace with following command:
driver --target=test_driver/main_app.dart --driver=test_driver/main_app_test.dart