Website: https://flatteredwithflutter.com/testing-bloc-in-flutte/
We will cover briefly about
Convention for Tests
Mocking Github API
Writing tests for BLoC
1. Convention for Tests
In general,
test files should reside inside a
test
folder located at the root of your Flutter application or package.Test files should always end with
_test.dart
.Tests are placed under the main function
void main() {
// ALL YOUR TESTS ARE PLACED HERE
}
If you have several tests that are related to one another, combine them using the
group
function.
void main() {
group('YOUR GROUP OF TESTS', () {
test('TEST 1', () {
});
test('TEST 2', () {
});
}
}
You can use a terminal to run the tests by
flutter test test/'YOUR TEST FILE NAME'.dart
Medium: https://levelup.gitconnected.com/testing-bloc-in-flutter-2deb1a1758ff
Website: https://flatteredwithflutter.com/testing-bloc-in-flutte/
DevTo: https://dev.to/aseemwangoo/testing-bloc-in-flutter-h2d