docs(example): added quick start steps in the example app readme
This commit is contained in:
parent
c8b951f720
commit
07472daaf1
|
@ -1,3 +1,7 @@
|
|||
## [0.0.6] - 31/10/2018
|
||||
|
||||
* Added quick start steps in the example app readme
|
||||
|
||||
## [0.0.5] - 29/10/2018
|
||||
|
||||
* Sorted out formatting of pre-defined steps
|
||||
|
|
|
@ -68,6 +68,8 @@ This implementation of the Gherkin tries to follow as closely as possible other
|
|||
|
||||
See <https://docs.cucumber.io/gherkin/> for information on the Gherkin syntax and Behaviour Driven Development (BDD).
|
||||
|
||||
See [example readme](example/README.md) for a quick start guide to running the example features and app.
|
||||
|
||||
The first step is to create a version of your app that has flutter driver enabled so that it can be automated. A good guide how to do this is show [here](https://flutter.io/cookbook/testing/integration-test-introduction/#4-instrument-the-app). However in short, create a folder called `test_driver` and within that create a file called `app.dart` and paste in the below code.
|
||||
|
||||
```dart
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
# example
|
||||
# Running the example
|
||||
|
||||
A new Flutter project.
|
||||
To run this example:
|
||||
|
||||
## Getting Started
|
||||
1. Ensure dart is accessible in the command line (on your path variable)
|
||||
2. Ensure an emulator or device is connected
|
||||
3. In a command prompt (from the root of this library):
|
||||
```bash
|
||||
cd example
|
||||
|
||||
For help getting started with Flutter, view our online
|
||||
[documentation](https://flutter.io/).
|
||||
dart test_driver/app_test.dart
|
||||
```
|
||||
This will run the features files found in the folder `test_driver/features` against this example app.
|
||||
|
||||
## Debugging the example
|
||||
|
||||
To debug this example and step through the library code.
|
||||
|
||||
1. Set a break point in `test_driver/app_test.dart`
|
||||
2. If you are in VsCode you will simply be able to select `Debug example` from the dropdown in the `debugging tab` as the `launch.json` has been configured.
|
||||
- otherwise you will need to run a debugging session against `test_driver/app_test.dart`.
|
||||
|
|
|
@ -8,13 +8,16 @@ import 'steps/tap_button_n_times_step.dart';
|
|||
|
||||
Future<void> main() {
|
||||
final config = FlutterTestConfiguration()
|
||||
..features = [Glob(r"test_driver/features/**/*.feature")]
|
||||
..reporters = [ProgressReporter()]
|
||||
..features = [Glob(r"test_driver/features/*.feature")]
|
||||
..reporters = [
|
||||
ProgressReporter()
|
||||
] // you can include the "StdoutReporter()" for more verbose information
|
||||
..hooks = [HookExample()]
|
||||
..stepDefinitions = [TapButtonNTimesStep(), GivenIPickAColour()]
|
||||
..customStepParameterDefinitions = [ColourParameter()]
|
||||
..restartAppBetweenScenarios = true
|
||||
..targetAppPath = "test_driver/app.dart"
|
||||
..exitAfterTestRun = true;
|
||||
// ..tagExpression = "@smoke" // uncomment to see an example of running scenarios based on tag expressions
|
||||
..exitAfterTestRun = true; // set to false if debugging to exit cleanly
|
||||
return GherkinRunner().execute(config);
|
||||
}
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
// // Imports the Flutter Driver API
|
||||
// import 'package:flutter_driver/flutter_driver.dart';
|
||||
// import 'package:test/test.dart';
|
||||
|
||||
// void main() {
|
||||
// group('Counter App', () {
|
||||
// // First, define the Finders. We can use these to locate Widgets from the
|
||||
// // test suite. Note: the Strings provided to the `byValueKey` method must
|
||||
// // be the same as the Strings we used for the Keys in step 1.
|
||||
// final counterTextFinder = find.byValueKey('counter');
|
||||
// final buttonFinder = find.byValueKey('increment');
|
||||
|
||||
// FlutterDriver driver;
|
||||
|
||||
// // Connect to the Flutter driver before running any tests
|
||||
// setUpAll(() async {
|
||||
// driver = await FlutterDriver.connect();
|
||||
// });
|
||||
|
||||
// // Close the connection to the driver after the tests have completed
|
||||
// tearDownAll(() async {
|
||||
// if (driver != null) {
|
||||
// driver.close();
|
||||
// }
|
||||
// });
|
||||
|
||||
// test('starts at 0', () async {
|
||||
// // Use the `driver.getText` method to verify the counter starts at 0.
|
||||
// expect(await driver.getText(counterTextFinder), "0");
|
||||
// });
|
||||
|
||||
// test('increments the counter', () async {
|
||||
// // First, tap on the button
|
||||
// await driver.tap(buttonFinder);
|
||||
|
||||
// // Then, verify the counter text has been incremented by 1
|
||||
// expect(await driver.getText(counterTextFinder), "1");
|
||||
// });
|
||||
// });
|
||||
// }
|
|
@ -1,6 +1,7 @@
|
|||
Feature: Counter
|
||||
The counter should be incremented when the button is pressed.
|
||||
|
||||
@smoke
|
||||
Scenario: Counter increases when the button is pressed
|
||||
Given I expect the "counter" to be "0"
|
||||
When I tap the "increment" button 10 times
|
||||
|
|
|
@ -2,6 +2,4 @@ Feature: Drawer
|
|||
|
||||
Scenario: should open the drawer
|
||||
Given I open the drawer
|
||||
# Given I close the drawer
|
||||
# Then I see the menu item "Item 1"
|
||||
# And I see the menu item "Item 2"
|
||||
Given I close the drawer
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: flutter_gherkin
|
||||
description: A Gherkin / Cucumber parser and test runner for Dart and Flutter
|
||||
version: 0.0.5
|
||||
version: 0.0.6
|
||||
author: Jon Samwell <jonsamwell@gmail.com>
|
||||
homepage: https://github.com/jonsamwell/flutter_gherkin
|
||||
|
||||
|
|
Loading…
Reference in New Issue