Skip to content

Commit

Permalink
chore(docs): removed references to Glob and update default config
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsamwell committed May 3, 2021
1 parent 8e66686 commit 4c4c442
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 40 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## [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):
* 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 need to import dart:io which is not available under certain environments (dartjs for example).
- 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 your patterns may not work anymore due as the default IoFeatureFileAccessor assumes the current directory is the working directory to search from.
- 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.

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

Expand Down
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,14 @@ Now that we have a testable app, a feature file and a custom step definition we
import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';
import 'hooks/hook_example.dart';
import 'steps/colour_parameter.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..features = [RegExp('features/*.*.feature')]
..reporters = [
ProgressReporter(),
TestRunSummaryReporter(),
Expand All @@ -192,7 +191,7 @@ Future<void> main() {
}
```

This code simple creates a configuration object and calls this library which will then promptly parse your feature files and run the tests. The configuration file is important and explained in further detail below. However, all that is happening is a `Glob` is provide which specifies the path to one or more feature files, it sets the reporters to the `ProgressReporter` report which prints the result of scenarios and steps to the standard output (console). The `TestRunSummaryReporter` prints a summary of the run once all tests have been executed. Finally it specifies the path to the testable app created above `test_driver/app.dart` . This is important as it instructions the library which app to run the tests against.
This code simple creates a configuration object and calls this library which will then promptly parse your feature files and run the tests. The configuration file is important and explained in further detail below. However, all that is happening is a `RegExp` is provide which specifies the path to one or more feature files, it sets the reporters to the `ProgressReporter` report which prints the result of scenarios and steps to the standard output (console). The `TestRunSummaryReporter` prints a summary of the run once all tests have been executed. Finally it specifies the path to the testable app created above `test_driver/app.dart` . This is important as it instructions the library which app to run the tests against.

Finally to actually run the tests run the below on the command line:

Expand All @@ -214,7 +213,7 @@ The parameters below can be specified in your configuration file:

*Required*

An iterable of `Glob` patterns that specify the location(s) of `*.feature` files to run. See <https://pub.dartlang.org/packages/glob>
An iterable of `Pattern` that specify the location(s) of `*.feature` files to run. See <https://api.dart.dev/stable/2.12.4/dart-core/Pattern-class.html>

#### tagExpression

Expand All @@ -236,13 +235,12 @@ Place instances of any custom step definition classes `Given` , `Then` , `When`
import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..features = [RegExp('features/*.*.feature')]
..reporters = [StdoutReporter()]
..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()]
..restartAppBetweenScenarios = true
Expand Down Expand Up @@ -299,14 +297,13 @@ Place instances of any custom step parameters that you have defined. These will
import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
import 'steps/colour_parameter.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..features = [RegExp('features/*.*.feature')]
..reporters = [StdoutReporter()]
..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()]
..customStepParameterDefinitions = [ColourParameter()]
Expand Down Expand Up @@ -350,15 +347,14 @@ To take a screenshot on a step failing you can used the pre-defined hook `Attach
import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';
import 'hooks/hook_example.dart';
import 'steps/colour_parameter.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..features = [RegExp('features/*.*.feature')]
..reporters = [
ProgressReporter(),
TestRunSummaryReporter(),
Expand Down Expand Up @@ -388,15 +384,14 @@ You should provide at least one reporter in the configuration otherwise it'll be

``` dart
import 'dart:async';
import 'package:glob/glob.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'steps/colour_parameter.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..features = [RegExp('features/*.*.feature')]
..reporters = [StdoutReporter()]
..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()]
..customStepParameterDefinitions = [ColourParameter()]
Expand All @@ -415,14 +410,13 @@ While it is not recommended so share state between steps within the same scenari

``` dart
import 'dart:async';
import 'package:glob/glob.dart';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..features = [RegExp('features/*.*.feature')]
..reporters = [StdoutReporter()]
..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()]
..createWorld = (TestConfiguration config) async => await createMyWorldInstance(config)
Expand Down Expand Up @@ -872,14 +866,13 @@ Finally ensure the hook is added to the hook collection in your configuration fi
import 'dart:async';
import 'package:flutter_gherkin/flutter_gherkin.dart';
import 'package:gherkin/gherkin.dart';
import 'package:glob/glob.dart';
import 'hooks/hook_example.dart';
import 'steps/given_I_pick_a_colour_step.dart';
import 'steps/tap_button_n_times_step.dart';
Future<void> main() {
final config = FlutterTestConfiguration()
..features = [Glob(r"test_driver/features/**.feature")]
..features = [RegExp('features/*.*.feature')]
..reporters = [ProgressReporter()]
..hooks = [HookExample()]
..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()]
Expand Down
1 change: 0 additions & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ dev_dependencies:
flutter_gherkin:
path: ../
path:
glob:

# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
Expand Down
2 changes: 1 addition & 1 deletion example/test_driver/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Future<void> main() {

final config = FlutterTestConfiguration.DEFAULT(
steps,
featurePath: 'features/**.feature',
featurePath: 'features/*.*.feature',
targetAppPath: 'test_driver/app.dart',
)
..hooks = [
Expand Down
Loading

0 comments on commit 4c4c442

Please sign in to comment.