-
Notifications
You must be signed in to change notification settings - Fork 111
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
It can't verify title page or content alert #55
Comments
It looks like your step line is different from your step definition
pattern. The definition has 'display' where as the step in the feature file
uses 'displays'.
I verify alert display {string}
vs
I verify alert displays "<verifyAlertDisplay"
Also check this step definition has been added to the stepDefinitions
collection in your configuration.
Also you can just use the command from dart rather than flutter drive
dart test_driver/bdd.dart
…On Fri, Feb 21, 2020, 21:20 hieutran ***@***.***> wrote:
Hello,
Today, I write a scenario to automation testing
*homePage.feature:*
Feature: AddFeature
Test add features
Scenario Outline: Verify clicking on "add" button
And I click the add button
Given I verify alert displays "<verifyAlertDisplay"
Examples:
| verifyAlertDisplay |
| Welcome to ExecuteAutomation 0 |
*homePage�Steps.dart*
class VerifyAlertDisplay extends Then1WithWorld<String, FlutterWorld> {
VerifyAlertDisplay()
: super(StepDefinitionConfiguration()..timeout = Duration(seconds: 10));
@OverRide <https://github.com/override>
Future executeStep(String value) async {
HomePage homePage = HomePage(world.driver);
expectMatch(await homePage.getAlertContent(), value);
}
@OverRide <https://github.com/override>
RegExp get pattern => RegExp(r"I verify alert display {string}");
}
I run the command : flutter drive --target=test_driver/bdd.dart
I only run step "I click the add button"
*Log:*
Using device Samsung Galaxy S10.
Starting application: test_driver/bdd.dart
Installing build/app/outputs/apk/app.apk... 6.2s
[!] Your app isn't using AndroidX.
To avoid potential build failures, you can quickly migrate your app by
following the steps on https://goo.gl/CP92wY.
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 18.9s
✓ Built build/app/outputs/apk/debug/app-debug.apk.
I/flutter ( 7826): Observatory listening on
http://127.0.0.1:40253/5tPDQkBPv0Q=/
Starting Flutter app under test 'test_driver/bdd.dart', this might take a
few moments
I/flutter ( 7889): Observatory listening on
http://127.0.0.1:45635/Cy4buza9j_8=/
before run hook
VMServiceFlutterDriver: Connecting to Flutter application at
http://127.0.0.1:62183/Cy4buza9j_8=/
VMServiceFlutterDriver: Isolate found with number: 2357604620073983
VMServiceFlutterDriver: Isolate is not paused. Assuming application is
ready.
VMServiceFlutterDriver: Connected to Flutter application.
running hook before scenario 'Verify clicking on "add" button (Example 1)'
Running scenario: Verify clicking on "add" button (Example 1) #
./test_driver/features/homePage.feature:10
√ And I click the add button # ./test_driver/features/homePage.feature:11
took 405ms
GherkinStepNotDefinedException: Step definition not found for text:
'Given I verify alert displays "Welcome to ExecuteAutomation 0"'
File path: ./test_driver/features/homePage.feature#12
Line: Given I verify alert displays "Welcome to ExecuteAutomation 0"
---------------------------------------------
You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:
/// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
/// All classes can take up to 5 input parameters anymore and you should probably us a table
/// For example: `When4<String, bool, int, num>`
/// You can also specify the type of world context you want
/// `When4WithWorld<String, bool, int, num, MyWorld>`
class Given_Given_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
@OverRide
RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");
@OverRide
Future<void> executeStep(String input1) async {
// If the step is "Given I do a 'windy pop'"
// in this example input1 would equal 'windy pop'
// your code...
}
}
GherkinStepNotDefinedException: Step definition not found for text:
'Given I verify alert displays "Welcome to ExecuteAutomation 0"'
File path: ./test_driver/features/homePage.feature#12
Line: Given I verify alert displays "Welcome to ExecuteAutomation 0"
---------------------------------------------
You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:
/// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
/// All classes can take up to 5 input parameters anymore and you should probably us a table
/// For example: `When4<String, bool, int, num>`
/// You can also specify the type of world context you want
/// `When4WithWorld<String, bool, int, num, MyWorld>`
class Given_Given_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
@OverRide
RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");
@OverRide
Future<void> executeStep(String input1) async {
// If the step is "Given I do a 'windy pop'"
// in this example input1 would equal 'windy pop'
// your code...
}
}
PASSED: Scenario Verify clicking on "add" button (Example 1) #
./test_driver/features/homePage.feature:10
Restarting Flutter app under test
running hook after scenario 'Verify clicking on "add" button (Example 1)'
GherkinStepNotDefinedException: Step definition not found for text:
'Given I verify alert displays "Welcome to ExecuteAutomation 0"'
File path: ./test_driver/features/homePage.feature#12
Line: Given I verify alert displays "Welcome to ExecuteAutomation 0"
---------------------------------------------
You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:
/// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
/// All classes can take up to 5 input parameters anymore and you should probably us a table
/// For example: `When4<String, bool, int, num>`
/// You can also specify the type of world context you want
/// `When4WithWorld<String, bool, int, num, MyWorld>`
class Given_Given_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
@OverRide
RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");
@OverRide
Future<void> executeStep(String input1) async {
// If the step is "Given I do a 'windy pop'"
// in this example input1 would equal 'windy pop'
// your code...
}
}
GherkinStepNotDefinedException: Step definition not found for text:
'Given I verify alert displays "Welcome to ExecuteAutomation 0"'
File path: ./test_driver/features/homePage.feature#12
Line: Given I verify alert displays "Welcome to ExecuteAutomation 0"
---------------------------------------------
You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:
/// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
/// All classes can take up to 5 input parameters anymore and you should probably us a table
/// For example: `When4<String, bool, int, num>`
/// You can also specify the type of world context you want
/// `When4WithWorld<String, bool, int, num, MyWorld>`
class Given_Given_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
@OverRide
RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");
@OverRide
Future<void> executeStep(String input1) async {
// If the step is "Given I do a 'windy pop'"
// in this example input1 would equal 'windy pop'
// your code...
}
}
1 scenario (1 passed)
1 step (1 passed)
0:00:06.238000
Unhandled exception:
GherkinStepNotDefinedException: Step definition not found for text:
'Given I verify alert displays "Welcome to ExecuteAutomation 0"'
File path: ./test_driver/features/homePage.feature#12
Line: Given I verify alert displays "Welcome to ExecuteAutomation 0"
---------------------------------------------
You must implement the step like below and add the class to the 'stepDefinitions' property in your configuration:
/// The 'Given' class can be replaced with 'Then', 'When' 'And' or 'But'
/// All classes can take up to 5 input parameters anymore and you should probably us a table
/// For example: `When4<String, bool, int, num>`
/// You can also specify the type of world context you want
/// `When4WithWorld<String, bool, int, num, MyWorld>`
class Given_Given_I_verify_alert_displays__Welcome_to_ExecuteAutomation_0_ extends Given1<String> {
@OverRide
RegExp get pattern => RegExp(r"I verify alert displays "Welcome to ExecuteAutomation 0"");
@OverRide
Future<void> executeStep(String input1) async {
// If the step is "Given I do a 'windy pop'"
// in this example input1 would equal 'windy pop'
// your code...
}
}
#0 FeatureFileRunner._matchStepToExectuableStep
(package:gherkin/src/feature_file_runner.dart:337:7)
#1 <#1>
FeatureFileRunner._runStep
(package:gherkin/src/feature_file_runner.dart:258:20)
#2 <#2> _rootRunUnary
(dart:async/zone.dart:1134:38)
#3 <#3>
_CustomZone.runUnary (dart:async/zone.dart:1031:19)
#4 <#4>
_FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#5 <#5>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:682:45)
#6 <#6>
Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#7 <#7>
Future._completeWithValue (dart:async/future_impl.dart:526:5)
#8 <#8>
_AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:34:15)
#9 <#9>
_completeOnAsyncReturn (dart:async-patch/async_patch.dart:293:13)
#10 <#10>
AggregatedReporter.onStepStarted
(package:gherkin/src/reporters/aggregated_reporter.dart)
#11 _rootRunUnary (dart:async/zone.dart:1134:38)
#12 <#12>
_CustomZone.runUnary (dart:async/zone.dart:1031:19)
#13 <#13>
_FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#14 <#14>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:682:45)
#15 <#15>
Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#16 <#16>
Future._completeWithValue (dart:async/future_impl.dart:526:5)
#17 <#17>
_AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:34:15)
#18 <#18>
_completeOnAsyncReturn (dart:async-patch/async_patch.dart:293:13)
#19 <#19>
AggregatedReporter._invokeReporters
(package:gherkin/src/reporters/aggregated_reporter.dart)
#20 _rootRunUnary (dart:async/zone.dart:1134:38)
#21 <#21>
_CustomZone.runUnary (dart:async/zone.dart:1031:19)
#22 <#22>
_FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#23 <#23>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:682:45)
#24 <#24>
Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#25 <#25>
Future._completeWithValue (dart:async/future_impl.dart:526:5)
#26 <#26>
_AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:34:15)
#27 <#27>
_completeOnAsyncReturn (dart:async-patch/async_patch.dart:293:13)
#28 <#28>
AggregatedReporter.onStepStarted.
(package:gherkin/src/reporters/aggregated_reporter.dart)
#29 <#29>
_rootRunUnary (dart:async/zone.dart:1134:38)
#30 <#30>
_CustomZone.runUnary (dart:async/zone.dart:1031:19)
#31 <#31>
_FutureListener.handleValue (dart:async/future_impl.dart:140:18)
#32 <#32>
Future._propagateToListeners.handleValueCallback
(dart:async/future_impl.dart:682:45)
#33 <#33>
Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#34 <#34>
Future._completeWithValue (dart:async/future_impl.dart:526:5)
#35 <#35>
Future._asyncComplete. (dart:async/future_impl.dart:556:7)
#36 <#36> _rootRun
(dart:async/zone.dart:1126:13)
#37 <#37>
_CustomZone.run (dart:async/zone.dart:1023:19)
#38 <#38>
_CustomZone.runGuarded (dart:async/zone.dart:925:7)
#39 <#39>
_CustomZone.bindCallbackGuarded. (dart:async/zone.dart:965:23)
#40 <#40>
_microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#41 <#41>
_startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#42 <#42>
_runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#43 <#43>
_RawReceivePortImpl._handleMessage
(dart:isolate-patch/isolate_patch.dart:169:5)
Stopping application instance.
Driver tests failed: 255
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#55?email_source=notifications&email_token=AA4F7IPL6SPLZOQWSV7WJYLRD6TFXA5CNFSM4KZAJWMKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IPIFYEA>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4F7IL6PBACQJOM7PD6J3LRD6TFXANCNFSM4KZAJWMA>
.
|
Hello, This step will get value from table >> I verify alert displays Welcome to ExecuteAutomation 0 When I will getText() of alert by command: homePage.getAlertContent() |
Yes it is saying you have not got a step definition that matches the
pattern you are trying to display. As I said previously the step text in
the feature does not match the regex in the step definiton. In the regex
you are using the word 'display' and the feature you are using the word
'displays'.
Please paste the configuration you are using into this issue and see my
previous comment about the difference between your step regex and the step
text in you feature file.
So I think you regex should be:
```
I verify alert displays {string}
```
The the line in for scenario outline should be:
```
Then I verify alert displays "<verifyAlertDisplay>"
```
NOTE THE 'S' IN THE WORD DISPLAYS!
Also if the above does not resolve the issue. Please provide a working repo
example where the issue appear so I can debug the problem.
Thanks
…On Sat, Feb 22, 2020, 23:47 hieutran ***@***.***> wrote:
Hello,
I verify alert displays "<verifyAlertDisplay ?>"
This step will get value from table >> I verify alert displays Welcome to
ExecuteAutomation 0
When I will getText() of alert by command: homePage.getAlertContent()
Next step, It will verify between get value from table and getText() of
alert:
expectMatch(await homePage.getAlertContent(), value);
*But Gherkin can't support in log:*
"GherkinStepNotDefinedException: Step definition not found for text:
'Then I verify alert displays "Welcome to ExecuteAutomation 0"'"
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#55?email_source=notifications&email_token=AA4F7IOW3CLDNAHZQ75IJGDREENEPA5CNFSM4KZAJWMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMU7O6A#issuecomment-589952888>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4F7ILMSWGS4J33HSJYJDLREENEPANCNFSM4KZAJWMA>
.
|
OK thank man. I got it |
Hello,
Today, I write a scenario to automation testing
homePage.feature:
Feature: AddFeature
Test add features
Scenario Outline: Verify clicking on "add" button
And I click the add button
Then I verify alert displays "<verifyAlertDisplay "
Examples:
| verifyAlertDisplay |
| Welcome to ExecuteAutomation 0 |
homePage�Steps.dart
I run the command : flutter drive --target=test_driver/bdd.dart
Log:
The text was updated successfully, but these errors were encountered: