dherkin2 1.0.0

  • README.md
  • CHANGELOG
  • Installing
  • Versions
  • new49

dherkin

Gherkin/cucumber implementation in dart.

For information on gherkin syntax and Behavior Driven Development (BDD) please see: http://cukes.info/

Fork

The fork of the project removed all Future-implementations and replaced them with the Dart2 async/await semantics. With this implementation the actual step implementations require a Completer as the first parameter that must be completed at the end of each test step. The reason is that the implementation uses the LibraryMirror.invoke method that cannot be used with await.

Usage

Dherkin can be executed in a number of ways.

cucumberd

Library comes with an executable runner script cucumberd in bin/ directory. Create symbolic link in a directory on your path, like /usr/local/bin:

cd /usr/local/bin
ln -s path/to/dherkin/bin/cucumberd .

Execute:

cucumberd examples/test_feature.feature

Note: cucumberd will auto-include all step definitions in steps/ sub-directory. Ability to add steps source locations via command-line arguments is planned.

Custom Runner

Alternatively, you might opt for writing your own script:

   library my_bdd_runner;

   import 'package:dherkin/dherkin.dart';
   import 'my_step_defs.dart'; // import stepdefs, mandatory since no auto-scanning happens

   main(args) {
     run(args);
   }

   // write your StepDefs below

Invoke the runner : $ dart my_bdd_runner.dart my_gherkin.feature

Anatomy of a stepdef

A stepdef is a top-level function annotated with one of Gherkin keywords. Such a function can take any number of positional parameters, and up to three optional named parameters.

@And("I am a table step \"(\\w+?)\"")
i_am_a_table(arg1, {exampleRow, table, out}) {
   out.writeln("Executing...${exampleRow['column2']}");
}

Table found on the step will be passed in as table. A scenario outline row will be passed in as exampleRow

Output

Due to asynchronous nature of execution, output of print statements will not appear near the gherkin step that ran them. For that purpose, optional named parameter out will be injected if the stepdef function states that it takes it

Parallelism

Features and scenarios are executed in multiple workers, so there is a degree of unpredictability of the order of execution.

Cucumberd

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dherkin2: "^1.0.0"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:dherkin2/dherkin.dart';

      import 'package:dherkin2/dherkin_core.dart';
  
Version Uploaded Documentation Archive
1.0.0 Jun 5, 2018 Go to the documentation of dherkin2 1.0.0 Download dherkin2 1.0.0 archive

Analysis

We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
49
Learn more about scoring.

Platforms

Detected platforms: other

Platform components identified in package: io, mirrors.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 12 hints.

    Run dartfmt to format lib/dherkin.dart.

    Run dartfmt to format lib/dherkin_core.dart.

    Similar analysis of the following files failed:

    • lib/src/gherkin_parser.dart (hint)
    • lib/src/model/background.dart (hint)
    • lib/src/model/feature.dart (hint)
    • lib/src/model/runtime.dart (hint)
    • lib/src/model/scenario.dart (hint)
    • lib/src/model/step.dart (hint)
    • lib/src/model/table.dart (hint)
    • lib/src/output/console_buffer.dart (hint)
    • lib/src/output/output.dart (hint)
    • lib/src/status/status.dart (hint)
  • Maintain an example.

    None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use dherkin2.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
ansicolor >=0.0.9 <0.1.0 0.0.9 0.1.0
args >=1.4.3 <1.5.0 1.4.3
log4dart >=1.4.10 <1.5.0 1.4.19
Transitive dependencies
sprintf 1.0.8 3.0.2
Dev dependencies
build_runner 0.8.0