From 8df7314a81ff09a05adbb33570c3478bc84cbff8 Mon Sep 17 00:00:00 2001 From: Jon Samwell Date: Tue, 25 May 2021 15:05:41 +1000 Subject: [PATCH] tests(feature-paths): fixed tests after change to allow absolute paths chore(release): updated release and changelog --- CHANGELOG.md | 3 ++ example/report.json | 2 +- lib/src/configuration.dart | 7 +++- lib/src/feature_file_runner.dart | 2 +- pubspec.yaml | 2 +- .../io/io_feature_file_accessor_gnu_test.dart | 16 +++++---- ...io_feature_file_accessor_windows_test.dart | 22 +++++++------ test/io/path_part_matcher.dart | 33 +++++++++++++++++++ 8 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 test/io/path_part_matcher.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ce0439..3b96dce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [2.0.2] - 25/05/2021 +* Fix #45 executing feature files outside of the current working directory + ## [2.0.1] - 02/05/2021 * BREAKING CHANGE: `TestFailure` is no longer thrown when an `expect` fails. Instead, use `GherkinTestFailure` when catching errors (i.e. replace `on TestFailure catch` with `on GherkinTestFailure catch`) (#37). diff --git a/example/report.json b/example/report.json index c1699b7..84745b4 100644 --- a/example/report.json +++ b/example/report.json @@ -1 +1 @@ -[{"description":"","id":"calculator","keyword":"Feature","line":1,"name":"Calculator","uri":"features\\calculator_can_add.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"calculator;add two numbers","name":"Add two numbers","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 1.5 and 2.1","line":5,"match":{"location":"features\\calculator_can_add.feature:5"},"result":{"status":"passed","duration":5000000},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"features\\calculator_can_add.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 3.6","line":7,"match":{"location":"features\\calculator_can_add.feature:7"},"result":{"status":"passed","duration":2000000},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator","keyword":"Feature","line":2,"name":"Calculator","uri":"features\\calculator_scenario_outline_german_example.feature","elements":[{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (1)","name":"Add two numbers Examples: (1)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 12 and 5","line":6,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 17","line":8,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (2)","name":"Add two numbers Examples: (2)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 20 and 5","line":6,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 25","line":8,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (3)","name":"Add two numbers Examples: (3)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 20937 and 1","line":6,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 20938","line":8,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (4)","name":"Add two numbers Examples: (4)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 20.937 and -1.937","line":6,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 19","line":8,"match":{"location":"features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator","keyword":"Feature","line":1,"name":"Calculator","uri":"features\\calculator_can_add_powers_of_two.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"calculator;add two number which are powers of two","name":"Add two number which are powers of two","description":"","line":4,"steps":[{"keyword":"Given ","name":"the powers 2^10 and 5^9","line":5,"match":{"location":"features\\calculator_can_add_powers_of_two.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"features\\calculator_can_add_powers_of_two.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 1954149","line":7,"match":{"location":"features\\calculator_can_add_powers_of_two.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator with background","keyword":"Feature","line":3,"name":"Calculator with Background","uri":"features\\calculator_background_example.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"calculator with background;add two numbers with background","name":"Add two numbers with background","description":"","line":10,"steps":[{"keyword":"Given ","name":"the numbers 100 and 50","line":7,"match":{"location":"features\\calculator_background_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"And ","name":"they are added","line":8,"match":{"location":"features\\calculator_background_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 150","line":11,"match":{"location":"features\\calculator_background_example.feature:11"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator can work with strings","keyword":"Feature","line":2,"name":"Calculator can work with strings","uri":"features\\calculator_count_strings.feature","tags":[{"line":1,"name":"@a"}],"elements":[{"keyword":"Scenario Outline","type":"scenario","id":"calculator can work with strings;counts string's code units examples: (1)","name":"Counts string's code units Examples: (1)","description":"","line":6,"tags":[{"line":5,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"the characters \"abc\"","line":7,"match":{"location":"features\\calculator_count_strings.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are counted","line":8,"match":{"location":"features\\calculator_count_strings.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 294","line":9,"match":{"location":"features\\calculator_count_strings.feature:9"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator can work with strings;counts string's code units examples: (2)","name":"Counts string's code units Examples: (2)","description":"","line":6,"tags":[{"line":5,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"the characters \"a b c\"","line":7,"match":{"location":"features\\calculator_count_strings.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are counted","line":8,"match":{"location":"features\\calculator_count_strings.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 358","line":9,"match":{"location":"features\\calculator_count_strings.feature:9"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator can work with strings;counts string's code units examples: (3)","name":"Counts string's code units Examples: (3)","description":"","line":6,"tags":[{"line":5,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"the characters \"a \\n b \\c\"","line":7,"match":{"location":"features\\calculator_count_strings.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are counted","line":8,"match":{"location":"features\\calculator_count_strings.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 684","line":9,"match":{"location":"features\\calculator_count_strings.feature:9"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator","keyword":"Feature","line":1,"name":"Calculator","uri":"features\\calculator_scenario_outline_example.feature","elements":[{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (1)","name":"Add two numbers Examples: (1)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 12 and 5","line":5,"match":{"location":"features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 17","line":7,"match":{"location":"features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (2)","name":"Add two numbers Examples: (2)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 20 and 5","line":5,"match":{"location":"features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 25","line":7,"match":{"location":"features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (3)","name":"Add two numbers Examples: (3)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 20937 and 1","line":5,"match":{"location":"features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 20938","line":7,"match":{"location":"features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (4)","name":"Add two numbers Examples: (4)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 20.937 and -1.937","line":5,"match":{"location":"features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 19","line":7,"match":{"location":"features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]}] \ No newline at end of file +[{"description":"","id":"calculator","keyword":"Feature","line":1,"name":"Calculator","uri":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature","elements":[{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (1)","name":"Add two numbers Examples: (1)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 12 and 5","line":5,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":5000000},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 17","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":1000000},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (2)","name":"Add two numbers Examples: (2)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 20 and 5","line":5,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 25","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (3)","name":"Add two numbers Examples: (3)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 20937 and 1","line":5,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 20938","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (4)","name":"Add two numbers Examples: (4)","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 20.937 and -1.937","line":5,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 19","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator can work with strings","keyword":"Feature","line":2,"name":"Calculator can work with strings","uri":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature","tags":[{"line":1,"name":"@a"}],"elements":[{"keyword":"Scenario Outline","type":"scenario","id":"calculator can work with strings;counts string's code units examples: (1)","name":"Counts string's code units Examples: (1)","description":"","line":6,"tags":[{"line":5,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"the characters \"abc\"","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are counted","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 294","line":9,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:9"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator can work with strings;counts string's code units examples: (2)","name":"Counts string's code units Examples: (2)","description":"","line":6,"tags":[{"line":5,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"the characters \"a b c\"","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are counted","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 358","line":9,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:9"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator can work with strings;counts string's code units examples: (3)","name":"Counts string's code units Examples: (3)","description":"","line":6,"tags":[{"line":5,"name":"@debug"}],"steps":[{"keyword":"Given ","name":"the characters \"a \\n b \\c\"","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are counted","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 684","line":9,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_count_strings.feature:9"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator with background","keyword":"Feature","line":3,"name":"Calculator with Background","uri":"C:\\github\\dart_gherkin\\example\\features\\calculator_background_example.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"calculator with background;add two numbers with background","name":"Add two numbers with background","description":"","line":10,"steps":[{"keyword":"Given ","name":"the numbers 100 and 50","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_background_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"And ","name":"they are added","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_background_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 150","line":11,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_background_example.feature:11"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator","keyword":"Feature","line":1,"name":"Calculator","uri":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"calculator;add two numbers","name":"Add two numbers","description":"","line":4,"steps":[{"keyword":"Given ","name":"the numbers 1.5 and 2.1","line":5,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 3.6","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator","keyword":"Feature","line":2,"name":"Calculator","uri":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature","elements":[{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (1)","name":"Add two numbers Examples: (1)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 12 and 5","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 17","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (2)","name":"Add two numbers Examples: (2)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 20 and 5","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 25","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (3)","name":"Add two numbers Examples: (3)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 20937 and 1","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 20938","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]},{"keyword":"Scenario Outline","type":"scenario","id":"calculator;add two numbers examples: (4)","name":"Add two numbers Examples: (4)","description":"","line":5,"steps":[{"keyword":"Gegeben ","name":"sei the numbers 20.937 and -1.937","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Wenn ","name":"they are added","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Dann ","name":"the expected result is 19","line":8,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_scenario_outline_german_example.feature:8"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]},{"description":"","id":"calculator","keyword":"Feature","line":1,"name":"Calculator","uri":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add_powers_of_two.feature","elements":[{"keyword":"Scenario","type":"scenario","id":"calculator;add two number which are powers of two","name":"Add two number which are powers of two","description":"","line":4,"steps":[{"keyword":"Given ","name":"the powers 2^10 and 5^9","line":5,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add_powers_of_two.feature:5"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"When ","name":"they are added","line":6,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add_powers_of_two.feature:6"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]},{"keyword":"Then ","name":"the expected result is 1954149","line":7,"match":{"location":"C:\\github\\dart_gherkin\\example\\features\\calculator_can_add_powers_of_two.feature:7"},"result":{"status":"passed","duration":0},"embeddings":[{"mime_type":"text/plain","data":"attachment data"}]}]}]}] \ No newline at end of file diff --git a/lib/src/configuration.dart b/lib/src/configuration.dart index 4a5ba42..c1a2d5f 100644 --- a/lib/src/configuration.dart +++ b/lib/src/configuration.dart @@ -2,13 +2,18 @@ import 'package:gherkin/src/io/feature_file_matcher.dart'; import 'package:gherkin/src/io/io_feature_file_accessor.dart'; import 'package:gherkin/src/io/feature_file_reader.dart'; -import '../gherkin.dart'; import './gherkin/parameters/custom_parameter.dart'; import './gherkin/steps/world.dart'; import './hooks/hook.dart'; import './reporters/reporter.dart'; import 'gherkin/attachments/attachment_manager.dart'; +import 'gherkin/steps/step_definition.dart'; +import 'reporters/json/json_reporter.dart'; +import 'reporters/message_level.dart'; +import 'reporters/progress_reporter.dart'; +import 'reporters/stdout_reporter.dart'; +import 'reporters/test_run_summary_reporter.dart'; typedef CreateWorld = Future Function(TestConfiguration config); typedef CreateAttachmentManager = Future Function( diff --git a/lib/src/feature_file_runner.dart b/lib/src/feature_file_runner.dart index 4325fb8..165ca20 100644 --- a/lib/src/feature_file_runner.dart +++ b/lib/src/feature_file_runner.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:gherkin/src/gherkin/runnables/scenario_type_enum.dart'; import 'package:collection/collection.dart'; -import '../gherkin.dart'; import './reporters/message_level.dart'; import './hooks/hook.dart'; import './reporters/reporter.dart'; @@ -20,6 +19,7 @@ import './gherkin/steps/step_run_result.dart'; import './gherkin/steps/world.dart'; import './reporters/messages.dart'; import './gherkin/attachments/attachment_manager.dart'; +import 'gherkin/exceptions/gherkin_exception.dart'; class FeatureFileRunner { final TestConfiguration _config; diff --git a/pubspec.yaml b/pubspec.yaml index 9a4432e..c23e084 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: gherkin -version: 2.0.1 +version: 2.0.2 description: A Gherkin parsers and runner for Dart which is very similar to Cucumber, it provides the base BDD functionality ready for use in platform specific implementations i.e. flutter/web homepage: https://github.com/jonsamwell/dart_gherkin diff --git a/test/io/io_feature_file_accessor_gnu_test.dart b/test/io/io_feature_file_accessor_gnu_test.dart index 38280a3..5af3935 100644 --- a/test/io/io_feature_file_accessor_gnu_test.dart +++ b/test/io/io_feature_file_accessor_gnu_test.dart @@ -4,6 +4,8 @@ import 'package:gherkin/gherkin.dart'; import 'package:glob/glob.dart'; import 'package:test/test.dart'; +import 'path_part_matcher.dart'; + void main() { group('Matcher', () { final indexer = IoFeatureFileAccessor(); @@ -12,7 +14,7 @@ void main() { test('lists all matching files', () async { expect( await indexer.listFiles(RegExp(r'test/test_resources/(.*).feature')), - containsAll([ + PathPartMatcher([ r'test/test_resources/a.feature', r'test/test_resources/subdir/b.feature', r'test/test_resources/subdir/c.feature', @@ -24,7 +26,7 @@ void main() { expect( await indexer .listFiles(RegExp(r'test/test_resources/subdir/.*\.feature')), - containsAll([ + PathPartMatcher([ r'test/test_resources/subdir/b.feature', r'test/test_resources/subdir/c.feature', ]), @@ -36,7 +38,7 @@ void main() { test('lists all matching files', () async { expect( await indexer.listFiles(Glob('test/test_resources/**.feature')), - containsAll([ + PathPartMatcher([ r'test/test_resources/a.feature', r'test/test_resources/subdir/b.feature', r'test/test_resources/subdir/c.feature', @@ -47,9 +49,9 @@ void main() { test('list all matching file without subdirectories', () async { expect( await indexer.listFiles(Glob('test/test_resources/*.feature')), - [ + PathPartMatcher([ r'test/test_resources/a.feature', - ], + ]), ); }); }); @@ -58,9 +60,9 @@ void main() { test('lists one specified file', () async { expect( await indexer.listFiles(r'test/test_resources/a.feature'), - [ + PathPartMatcher([ r'test/test_resources/a.feature', - ], + ]), ); }); }); diff --git a/test/io/io_feature_file_accessor_windows_test.dart b/test/io/io_feature_file_accessor_windows_test.dart index a96300d..34a2b87 100644 --- a/test/io/io_feature_file_accessor_windows_test.dart +++ b/test/io/io_feature_file_accessor_windows_test.dart @@ -4,6 +4,8 @@ import 'package:gherkin/gherkin.dart'; import 'package:glob/glob.dart'; import 'package:test/test.dart'; +import 'path_part_matcher.dart'; + void main() { group('Matcher', () { final indexer = IoFeatureFileAccessor(); @@ -13,11 +15,11 @@ void main() { expect( await indexer .listFiles(RegExp(r'test\\test_resources\\(.*).feature')), - [ + PathPartMatcher([ r'test\test_resources\a.feature', r'test\test_resources\subdir\b.feature', r'test\test_resources\subdir\c.feature', - ], + ]), ); }); @@ -25,10 +27,10 @@ void main() { expect( await indexer .listFiles(RegExp(r'test\\test_resources\\subdir\\.*\.feature')), - [ + PathPartMatcher([ r'test\test_resources\subdir\b.feature', r'test\test_resources\subdir\c.feature', - ], + ]), ); }); }); @@ -37,20 +39,20 @@ void main() { test('lists all matching files', () async { expect( await indexer.listFiles(Glob('test/test_resources/**.feature')), - [ + PathPartMatcher([ r'test\test_resources\a.feature', r'test\test_resources\subdir\b.feature', r'test\test_resources\subdir\c.feature', - ], + ]), ); }); test('list all matching file without subdirectories', () async { expect( await indexer.listFiles(Glob('test/test_resources/*.feature')), - [ + PathPartMatcher([ r'test\test_resources\a.feature', - ], + ]), ); }); }); @@ -59,9 +61,9 @@ void main() { test('lists one specified file', () async { expect( await indexer.listFiles(r'test\test_resources\a.feature'), - [ + PathPartMatcher([ r'test\test_resources\a.feature', - ], + ]), ); }); }); diff --git a/test/io/path_part_matcher.dart b/test/io/path_part_matcher.dart new file mode 100644 index 0000000..225382a --- /dev/null +++ b/test/io/path_part_matcher.dart @@ -0,0 +1,33 @@ +import 'package:matcher/matcher.dart'; + +class PathPartMatcher extends Matcher { + late final Iterable relativePaths; + final description = StringDescription(); + + PathPartMatcher(this.relativePaths); + + @override + Description describe(Description description) { + return description..add(description.toString()); + } + + @override + bool matches(dynamic absolutePaths, Map matchState) { + var match = true; + + for (var absPath in (absolutePaths as Iterable)) { + var internalMatch = false; + + for (var relativePath in relativePaths) { + if (absPath.contains(relativePath)) { + internalMatch = true; + break; + } + } + + match = match && internalMatch; + } + + return match; + } +}