Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration_test package support and null-safety #125

Open
wants to merge 117 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
7ba5246
feat(integration_test): added concept of an app driver adapter puttin…
jonsamwell Jan 7, 2021
68f3a6e
Update steps to work with new app driver adapter
jonsamwell Jan 7, 2021
f1fb2d4
feat(integration_test): add a WidgetTester app driver adapter
jonsamwell Jan 7, 2021
c307008
feat(project): re-organised project structure
jonsamwell Jan 7, 2021
07f16dc
test(config): fixed tests
jonsamwell Jan 7, 2021
e4af918
chore(project): move structure changes and remove FlutterDriverUtils …
jonsamwell Jan 7, 2021
6d474d4
feat(integration_test): first pass of code generation and gherkin tes…
jonsamwell Jan 7, 2021
9ba3ced
chore(libs): referencing the update dart_gherkin branch
jonsamwell Jan 7, 2021
7dc4408
feat(dependencies): added in calls to reporters and hooks
jonsamwell Jan 8, 2021
cf8d28d
feat(integration_test): more progress with reporting
jonsamwell Jan 8, 2021
6c6d76c
chore(lint): fixes
jonsamwell Jan 8, 2021
b75ce7b
feat(reporters): got the json reporter working and results saving
jonsamwell Jan 9, 2021
792f879
chore(lib): updated changelog
jonsamwell Jan 9, 2021
2111b71
fix(flutter_driver): various changes to get the flutter_driver part o…
jonsamwell Jan 9, 2021
c4cd66e
feat(integration_test): added much better example app that resets sta…
jonsamwell Jan 11, 2021
f8eb155
fix(reports): fixed default report path
jonsamwell Jan 11, 2021
89c9375
fix(generation): escape text in strings
jonsamwell Jan 12, 2021
b17ea6c
fix(adapters): fixed issue with isPresent for test widget adapter
jonsamwell Jan 12, 2021
954f8da
fixes for changelog
Jan 12, 2021
018dbbe
Merge pull request #109 from vrnvorona/integration_test__package_support
jonsamwell Jan 12, 2021
b1f4bf7
fix(appDriver): fixed issue when trying to scroll using the WidgetTes…
jonsamwell Jan 12, 2021
0bf4724
fix(adapter): fix scrollUntilVisible in adatpers
jonsamwell Jan 13, 2021
fcd7c8f
feature folder fix in changelog
Jan 13, 2021
c372525
Merge pull request #110 from vrnvorona/integration_test__package_support
jonsamwell Jan 13, 2021
2727535
feat(drivers): added typed driver flutter world
jonsamwell Jan 13, 2021
d4c43aa
feat(expressions): now evaluating tag expressions before running a sc…
jonsamwell Jan 13, 2021
78078b2
fix(world): fixed drvier world typing
jonsamwell Jan 13, 2021
2a9a8dd
fix(worlds): update to typed world
jonsamwell Jan 13, 2021
86cb32b
fix(world): updated typed flutter world
jonsamwell Jan 14, 2021
ba74e74
fix(steps): wait for app to settle after page back
jonsamwell Jan 14, 2021
230a8e8
fix(steps): added pump invokes to some steps
jonsamwell Jan 14, 2021
ef04fa3
fix(integration_test): ensure tearDownAll is always run
jonsamwell Jan 21, 2021
c3b4eb5
fix(widget): fixed screenshot using widget tester
jonsamwell Jan 21, 2021
316f36b
fix(driver): ensure timeout on tap is respected
jonsamwell Feb 5, 2021
1788439
fix(steps): ensure wait for element step actually waits rather than t…
jonsamwell Feb 8, 2021
5f02011
fix(steps): ensure app is pumped after step actions
jonsamwell Feb 10, 2021
172dde7
fix(api): expose widget tester flutter world
jonsamwell Apr 30, 2021
31bf38c
feat(null-safety): first pass of null safety
jonsamwell May 1, 2021
a90f9fb
feat(null-satefy): more lib version tweaks
jonsamwell May 1, 2021
a2dd321
chore(null-safety): more fixes
jonsamwell May 25, 2021
cfb9feb
chore(dependencies): updates to pubspec to allow alpha release
jonsamwell May 25, 2021
6d54ef7
chore(rename): renamed rawDriver -> nativeDriver
jonsamwell May 25, 2021
359c800
chore(lint): various code liniting changes
jonsamwell May 25, 2021
f47dc7c
chore(gen): regenerated tests
jonsamwell May 25, 2021
a9e8607
chore(libs): updated to latest dart_gherkin
jonsamwell Jun 20, 2021
0f99f0f
fix(#150 #141 #128): fixed handling of json in multiline string and i…
jonsamwell Sep 15, 2021
c682fc6
chore(lib): fixed lib constraint warning
jonsamwell Sep 15, 2021
ed88094
chore(debug): removed debug code
jonsamwell Sep 15, 2021
3c0e1c6
fix(runner): Ensure scenario support files (world etc) as always disp…
jonsamwell Sep 16, 2021
2db755d
- BREAKING CHANGE: Made `appMainFunction` return a `Future<void>` so …
jonsamwell Oct 27, 2021
29eeb73
- Fix: #165: Empty .feature files causing void functions which get co…
jonsamwell Nov 10, 2021
220dfd7
Fixed an issue with code generation.
AFASbart Nov 12, 2021
a586cb4
updated isNotEmpty
AFASbart Nov 13, 2021
d551fb4
Merge pull request #168 from AFASbart/integration_test__package_support
jonsamwell Nov 15, 2021
c5d9197
fix(generation): fix when generating empty feature files
jonsamwell Nov 18, 2021
c7281d6
chore(libs): updated to latest dart_gherkin release
jonsamwell Nov 23, 2021
4ef9105
Reversed the path change for this pull request.
AFASbart Dec 17, 2021
8c43d91
Fixed unnecessary assignment in runScenario
AFASbart Dec 21, 2021
7f809da
Changed consistency of @deprecated
AFASbart Dec 21, 2021
47c49f1
Merge pull request #192 from AFASbart/fixTips
jonsamwell Jan 6, 2022
09b2a47
Merge pull request #187 from AFASbart/fix_deprated
jonsamwell Jan 6, 2022
55c19dc
Allow disabling handle semantics in testWidgets
Gustl22 Feb 5, 2022
1913832
Merge pull request #200 from golane-august/semantics-option
jonsamwell Feb 6, 2022
434db84
Added path support
BartVerm779 Mar 14, 2022
f8b41b6
Fix CHANGELOG filename
Mar 31, 2022
ea59f63
Update README.md
Mar 31, 2022
013db28
Merge pull request #215 from vrnvorona/patch-1
AFASbart May 3, 2022
61146d8
Merge pull request #1 from jonsamwell/integration_test__package_support
AFASbart May 3, 2022
3772e89
The test case gets retried 3 times and the other steps will get skipped
AFASbart May 3, 2022
06d6908
Max attempts can be changed by the user
AFASbart May 3, 2022
684ce1f
Update pubspec.lock
AFASbart May 3, 2022
06bbd80
Update pubspec.yaml
AFASbart May 3, 2022
b521a3f
Revert "Added path support"
BartVerm779 Mar 14, 2022
c9c01f8
Merge remote-tracking branch 'origin/integration_test__package_suppor…
AFASbart May 3, 2022
eb3827c
Lint fixes
AFASbart May 4, 2022
0229d5a
Merge pull request #220 from BartVerm779/integration_test__package_su…
jonsamwell May 4, 2022
6339791
Fixed the max retries to at least have 1 try and a delay has been added
AFASbart May 4, 2022
c6b64ca
Merge pull request #221 from BartVerm779/integration_test__package_su…
jonsamwell May 6, 2022
5c15f0c
Started on the dart_gherkin 3.0 conversion
AFASbart Jun 15, 2022
0961916
feat(config): re-worked configuration so it can stay mostly immutable
jonsamwell Jun 17, 2022
551a4fc
chore(lints): fixed linting and improved code quality
jonsamwell Jun 20, 2022
2c5ba2a
fix(app): pump and settle app after test to ensure finalisation can h…
jonsamwell Jun 23, 2022
56aa208
chore(docs): added configuration hint
jonsamwell Jun 23, 2022
1a1ff50
Merge pull request #230 from jonsamwell/dart-3.0support
jonsamwell Jun 23, 2022
3d07f5b
chore(lib): remove file that should not be checked in
jonsamwell Jun 23, 2022
b2a01ab
chore(version): ensure this branch is still published under a rc release
jonsamwell Jun 23, 2022
70f1c6c
chore(docs): made changelog match pubspec version number
jonsamwell Jun 23, 2022
1f63ecc
- Fix #231 - Removed the use of explicitly calling `pumpAndSettle` …
jonsamwell Jun 24, 2022
6736af3
fix(#222): escape single quotation marks in data tables
jonsamwell Jun 24, 2022
9667db0
- Fix #235 - fix issue taking a screenshot on an Android device
jonsamwell Jun 27, 2022
66919d6
fix(#237): remove reference to dart:html and gaurd stdout function so…
jonsamwell Jun 27, 2022
b73da40
fix(#231): Exposed `frameBindingPolicy` on the test runner when runni…
jonsamwell Jun 29, 2022
7ee9f80
- Fix #231 - using local coordinate system when taking a screenshot…
jonsamwell Jul 1, 2022
ce1edac
feat: add standard configuration for web
robert-virkus Jul 6, 2022
be29f5a
Fix redundant escaping
Jul 6, 2022
8ae1e47
--keep-app-running is no more avaliable
Jul 12, 2022
a29dc02
Merge pull request #250 from huylg/integration_test__package_support
jonsamwell Jul 12, 2022
c80557e
Merge pull request #246 from youssef-t/integration_test__package_support
jonsamwell Jul 12, 2022
4378a24
Merge pull request #244 from robert-virkus/integration_test__package_…
jonsamwell Jul 12, 2022
eff8250
- Fix #257 - fixed issue when generating a step with a '$' sign in
jonsamwell Jul 25, 2022
a16595d
Change scroll code to make it working also for AnimatedList
lsuhov Oct 27, 2022
7c8be5f
Merge pull request #273 from lsuhov/integration_test__package_support
jonsamwell Oct 28, 2022
f42a15d
Added the possibility to use flutter test instead of flutter drive
AFASbart Dec 7, 2022
2ac54f0
Updated README
AFASbart Dec 7, 2022
9af4256
Forgot to delete 3 lines from my own project
AFASbart Dec 7, 2022
b7c50bd
Update lib/src/flutter/code_generation/generators/gherkin_suite_test_…
AFASbart Dec 24, 2022
e8c874f
Update lib/src/flutter/code_generation/generators/gherkin_suite_test_…
AFASbart Dec 24, 2022
8f34c82
Merge pull request #279 from jonsamwell/test-compatibility
jonsamwell Dec 26, 2022
7f18bba
fix: remove bracket on gherkin generator
golane-august Dec 29, 2022
52de53c
chore(lib): analyzer <6.0.0 insteal 5.0.0
timobaehr May 12, 2023
49772f3
Merge pull request #290 from timobaehr/integration_test__package_support
jonsamwell May 12, 2023
c265c96
Fix code generation error after b7c50bde9f63eee0a6bd3bf444ec471b063aa8e3
vrnvorona May 17, 2023
7f08941
Merge pull request #292 from vrnvorona/patch-2
jonsamwell Jul 13, 2023
4a5b727
Merge branch 'integration_test__package_support' into fix/remove-brac…
jonsamwell Jul 13, 2023
d15ec4c
Merge pull request #280 from golane-august/fix/remove-bracket-generator
jonsamwell Jul 13, 2023
6e9ae4a
Remove unnecessary_await_in_return warning from gherkin g.dart files
lsuhov Aug 4, 2023
cd02af0
Merge pull request #305 from lsuhov/integration_test__package_support
jonsamwell Aug 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flutter-plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This is a generated file; do not edit or check into version control.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be ignored

integration_test=C:\\Google\\flutter\\packages\\integration_test\\
1 change: 1 addition & 0 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"android":[{"name":"integration_test","path":"C:\\\\Google\\\\flutter\\\\packages\\\\integration_test\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"integration_test","dependencies":[]}],"date_created":"2021-10-27 20:12:58.071212","version":"2.5.3"}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ build/
ios/.generated/
ios/Flutter/Generated.xcconfig
ios/Runner/GeneratedPluginRegistrant.*

node_modules
package-lock.json
29 changes: 23 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,33 @@
"version": "0.2.0",
"configurations": [
{
"name": "Flutter",
"name": "Debug integration_test app",
"request": "launch",
"type": "dart"
"type": "dart",
"cwd": "example_with_integration_test/",
},
{
"name": "Debug integration_test example tests",
"program": "test_driver/integration_test_driver.dart",
"cwd": "example_with_integration_test/",
"request": "launch",
"type": "dart",
"args": [
"--target=integration_test/gherkin_suite_test.dart",
],
},
{
"name": "Debug example tests",
"program": "app_test.dart",
"cwd": "example/test_driver",
"name": "Debug flutter_driver app",
"request": "launch",
"type": "dart",
}
"cwd": "example_with_flutter_driver/",
},
{
"name": "Debug flutter_driver example tests",
"program": "test_harness.dart",
"cwd": "example_with_flutter_driver/test_driver",
"request": "launch",
"type": "dart",
},
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"cSpell.words": [
"Errored",
"Serializable",
"agnostically",
"microtask",
"multiline",
"pubspec",
"scrollable",
"todos",
"writeln"
]
}
165 changes: 164 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,166 @@
## [3.0.0-rc.6] - 27/10/2021

- BREAKING CHANGE: Made `appMainFunction` return a `Future<void>` so it can be async
- Fix: #159: Swipe step not working
- Ensure Hook.onBeforeRun is called before the run starts
- Set Frame policy- defaults to `LiveTestWidgetsFlutterBindingFramePolicy.benchmarkLive` to slightly improve performance

## [3.0.0-rc.5] - 22/06/2021

- Ensure scenario support files (world etc) as always disposed ensure when test throws error

## [3.0.0-rc.4] - 21/06/2021

- Removed debug code

## [3.0.0-rc.3] - 21/06/2021

- POSSIBLE BREAKING CHANGE: Removed tap call before enterText is invoked in `WidgetTesterAppDriverAdapter` this was due to the fact that it opens the on-screen keyboard which is not closed after the text is entered so it could be blocking further controls from view.
- Fix: #150: Better handling of JSON strings in multiline string segments in feature files
- Fix: #141 & #128: Added example of how to generate html report from json report output and fixed all scenarios ending up in the last feature section of the json report

## [3.0.0-rc.2] - 21/06/2021

- Fixed late initialization error when invoking hooks
- Updated float parameter parser so an exception is not thrown during parsing

## [3.0.0-rc.1] - 25/05/2021

HUGE update so that the library now works and favours the flutter integration_test package over flutter_driver. Unfortunately, this will be breaking change to existing users but it has many benefits such as a huge speed and stability improvements.

# BREAKING CHANGES

- `Table` has been renamed to `GherkinTable` to avoid naming clashes

In order to progress this library and add support for the new integration_test package various things have had to be changed to enable this will still supporting Flutter Driver. The big of which is removing Flutter Driver instance from the `FlutterWorld` instance in favour of an adapter approach whereby driving of the app (whether that is via `flutter_driver` or `WidgetTester`) becomes agnostic see `https://github.com/jonsamwell/flutter_gherkin/blob/f1fb2d4a632362629f5d1a196a0c055f858ad1d7/lib/src/flutter/adapters/app_driver_adapter.dart`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In order to progress this library and add support for the new integration_test package various things have had to be changed to enable this will still supporting Flutter Driver. The big of which is removing Flutter Driver instance from the `FlutterWorld` instance in favour of an adapter approach whereby driving of the app (whether that is via `flutter_driver` or `WidgetTester`) becomes agnostic see `https://github.com/jonsamwell/flutter_gherkin/blob/f1fb2d4a632362629f5d1a196a0c055f858ad1d7/lib/src/flutter/adapters/app_driver_adapter.dart`.
In order to progress this library and add support for the new `integration_test` package, various things have had to be changed while still supporting Flutter Driver. The biggest of which is removing Flutter Driver instance from the `FlutterWorld` instance in favour of an adapter approach. This makes driving of the app (whether that is via `flutter_driver` or `WidgetTester`) [agnostic](https://github.com/jonsamwell/flutter_gherkin/blob/f1fb2d4a632362629f5d1a196a0c055f858ad1d7/lib/src/flutter/adapters/app_driver_adapter.dart).


- `FlutterDriverUtils` has been removed, use `world.appDriver` instead. You can still access the raw driver if needed via `world.appDriver.nativeDriver`
- If you are using a custom world object and still want to use Flutter Driver it will need to extend `FlutterDriverWorld` instead of `FlutterWorld` this will give you type safety on the `world.appDriver.nativeDriver` property

The change to use the `integration_test` package is a fundamentally different approach. Where using the `flutter_driver` implementation your app is launch in a different process and then controlled by remote RPC calls from flutter driver in a different process. Using the new `integration_test` package your tests surround your app and become the app themselves. This removes the need for RPC communication from an external process into the app as well as giving you access to the internal state of your app. This is an altogether better approach, one that is quicker, more maintainable, scalable to device testing labs. However, it brings with it, its own set of challenges when trying to make this library work with it. Traditionally this library has evaluated the Gherkin feature files at run time, then used that evaluation to invoke actions against the app under test. However, as the tests need to surround the app in the `integration_test` view of the world the Gherkin tests need to be generated at development time so they can be complied in to a test app. Much like `json_serializable` creates classes that are able to work with json data.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The change to use the `integration_test` package is a fundamentally different approach. Where using the `flutter_driver` implementation your app is launch in a different process and then controlled by remote RPC calls from flutter driver in a different process. Using the new `integration_test` package your tests surround your app and become the app themselves. This removes the need for RPC communication from an external process into the app as well as giving you access to the internal state of your app. This is an altogether better approach, one that is quicker, more maintainable, scalable to device testing labs. However, it brings with it, its own set of challenges when trying to make this library work with it. Traditionally this library has evaluated the Gherkin feature files at run time, then used that evaluation to invoke actions against the app under test. However, as the tests need to surround the app in the `integration_test` view of the world the Gherkin tests need to be generated at development time so they can be complied in to a test app. Much like `json_serializable` creates classes that are able to work with json data.
The change to use the `integration_test` package is a fundamentally different approach. Using the `flutter_driver` implementation, your app is launched within a different process and then controlled by remote RPC calls from flutter driver in a different process. Using the new `integration_test` package, your tests surround your app and become the app themselves. This removes the need for RPC communication from an external process into the app as well as giving you access to the internal state of your app. This is an altogether better approach: one that is quicker, more maintainable, scalable to device testing labs. However, it brings with it, its own set of challenges when trying to make this library work with it. Traditionally, this library has evaluated the Gherkin feature files at run time, then used that evaluation to invoke actions against the app under test. However, as the tests need to surround the app in the `integration_test` view of the world, the Gherkin tests need to be generated at development time so they can be complied in to a test app. Much like `json_serializable`, this creates classes that are able to work with json data.


### Steps to get going
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also live in the README. Or it should only live in the README and this section of the CHANGELOG links to the README.md


1. Add the following `dev_dependencies` to your app's `pubspec.yaml` file
- integration_test
- build_runner
- flutter_gherkin
2. Add the following `build.yaml` to the root of your project. This file allows the dart code generator to target files outside of your application's `lib` folder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually have build.yaml in your package and not require the implementation to import it (I'll add a comment on the build.yaml). I actually believe this leads to less confusion in implementation since they all go through the same flutter pub run build_runner build hook

```yaml
targets:
$default:
sources:
- lib/**
- pubspec.*
- $package$
# Allows the code generator to target files outside of the lib folder
- integration_test/**.dart
```
3. Add the following file (and folder) `\test_driver\integration_test_driver.dart`. This file is the entry point to run your tests. See `https://flutter.dev/docs/testing/integration-tests` for more information.
```dart
import 'package:integration_test/integration_test_driver.dart' as integration_test_driver;

Future<void> main() {
// The Gherkin report data send back to this runner by the app after
// the tests have run will be saved to this directory
integration_test_driver.testOutputsDirectory = 'integration_test/gherkin/reports';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has GNU slashes, FWIW


return integration_test_driver.integrationDriver(
timeout: Duration(minutes: 90),
);
}
```
4. Create a folder call `integration_test` this will eventually contain all your Gherkin feature files and the generated test files.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
4. Create a folder call `integration_test` this will eventually contain all your Gherkin feature files and the generated test files.
4. Create a folder called `integration_test`: this will eventually contain all your Gherkin feature files and the generated test files.

5. Add the following file (and folder) `integration_test\features\counter.feature` with the following below contents. This is a basic feature file that will be transform in to a test file that can run a test against the sample app.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5. Add the following file (and folder) `integration_test\features\counter.feature` with the following below contents. This is a basic feature file that will be transform in to a test file that can run a test against the sample app.
5. Add the following file (and folder) `integration_test\features\counter.feature` with the following below contents. This is a basic feature file that will be transform into a test file that can run a test against the sample app.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this should be broken up. This is part example / part required set up. There should be two distinct instruction sets: one as a tutorial to follow for new implementations and the other a migration guide for existing implementations.

```
Feature: Counter

Scenario: User can increment the counter
Given I expect the "counter" to be "0"
When I tap the "increment" button
Then I expect the "counter" to be "1"
```
6. Add the following file (and folder) `integration_test\gherkin_suite_test.dart`. Notice the attribute `@GherkinTestSuite()` this indicates to the code generator to create a partial file for this file with the generated Gherkin tests in `part 'gherkin_suite_test.g.dart';`. Don't worry about the initial errors as this will disappear when the tests are generated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
6. Add the following file (and folder) `integration_test\gherkin_suite_test.dart`. Notice the attribute `@GherkinTestSuite()` this indicates to the code generator to create a partial file for this file with the generated Gherkin tests in `part 'gherkin_suite_test.g.dart';`. Don't worry about the initial errors as this will disappear when the tests are generated.
6. Add the following file (and folder) `integration_test\gherkin_suite_test.dart`. Notice the attribute `@GherkinTestSuite()`: this indicates to the code generator to create a partial file for this file with the generated Gherkin tests in `part 'gherkin_suite_test.g.dart';`. Don't worry about the initial errors; these will disappear when the tests are generated.

```dart
import 'package:flutter_gherkin/flutter_gherkin_integration_test.dart'; // notice new import name
import 'package:flutter_test/flutter_test.dart';
import 'package:gherkin/gherkin.dart';

// The application under test.
import 'package:example_with_integration_test/main.dart' as app;

part 'gherkin_suite_test.g.dart';

@GherkinTestSuite()
void main() {
executeTestSuite(
FlutterTestConfiguration.DEFAULT([])
..reporters = [
StdoutReporter(MessageLevel.error)
..setWriteLineFn(print)
..setWriteFn(print),
ProgressReporter()
..setWriteLineFn(print)
..setWriteFn(print),
TestRunSummaryReporter()
..setWriteLineFn(print)
..setWriteFn(print),
JsonReporter(
writeReport: (_, __) => Future<void>.value(),
),
Comment on lines +172 to +177
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a POC, this should be as narrow as possible

Suggested change
TestRunSummaryReporter()
..setWriteLineFn(print)
..setWriteFn(print),
JsonReporter(
writeReport: (_, __) => Future<void>.value(),
),

],
(World world) => app.main(),
);
}
```
7. We now need to generate the test by running the builder command from the command line in the root of your project. Much like `json_serializable` this will create a `.g.dart` part file that will contain the Gherkin tests in code format which are able to via using the `integration_test` package.
```
flutter pub run build_runner build
```
8. The errors in the `integration_test\gherkin_suite_test.dart` file should have not gone away and it you look in `integration_test\gherkin_suite_test.g.dart` you will see the coded version of the Gherkin tests described in the feature file `integration_test\features\counter.feature`.
9. We can now run the test using the below command from the root of your project.
```
flutter drive --driver=test_driver/integration_test_driver.dart --target=integration_test/gherkin_suite_test.dart
```
10. You can debug the tests by adding a breakpoint to line 12 in `integration_test\gherkin_suite_test.dart` and adding the below to your `.vscode\launch.json` file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steps 10-11 should be separated under an optional section and not considered "steps". 1-9 is a lot to juggle

```json
{
"name": "Debug integration_test",
"program": "test_driver/integration_test_driver.dart",
"cwd": "example_with_integration_test/",
"request": "launch",
"type": "dart",
"args": [
"--target=integration_test/gherkin_suite_test.dart",
],
}
```
11. Custom world need to extend `FlutterWorld` note `FlutterDriverWorld`.
12. If you change any of the feature files you will need to re-generate the tests using the below command
```
# you might need to run the clean command first if you have just changed feature files
flutter pub run build_runner clean

flutter pub run build_runner build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flutter pub run build_runner watch may also be useful to avoid trying to remember to run this

```

## [2.0.0] - 25/05/2021
* null-safety migration, thanks to @tshedor

## [1.2.0] - 02/05/2021

* Upgraded to the null-safety version of dart_gherkin, as such there are some breaking changes to be aware of (see https://github.com/jonsamwell/dart_gherkin/blob/master/CHANGELOG.md for the full list):
- BREAKING CHANGE: Table has been renamed to GherkinTable to avoid naming clashes
- BREAKING CHANGE: exitAfterTestRun configuration option has been removed as it depends on importing dart:io which is not available under certain environments (dartjs for example).
- BREAKING CHANGE: Reporter->onException() exception parameter is now an object rather than an exception
- POSSIBLE BREAKING CHANGE: Feature file discovery has been refactored to abstract it from the external Glob dependency. It now support the three native dart Patterns (String, RegExp & Glob). There is potential here for your patterns to not work anymore due as the default IoFeatureFileAccessor assumes the current directory is the working directory to search from. For the most part this simple regex is probably enough to get you going.

```
RegExp('features/*.*.feature')
```

* Allow dart-define to be passed to the Flutter build (thanks @Pholey)

## [1.1.9] - 24/11/2020
* Fixes #93 & #92 - Error waiting for no transient callbacks from Flutter driver
* Added option to leave Flutter app under test running when the tests finish see `keepAppRunningAfterTests` configuration property
Expand Down Expand Up @@ -258,4 +421,4 @@ When I long press "controlKey" icon for 1500 milliseconds

## [0.0.1] - 29/10/2018

* Initial working release
* Initial working release
Loading