dherkin2 1.0.1+1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 63

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.

1.0.1+1 #

  • Introduced this changelog.

1.0.1 #

  • Upgraded all dependencies.
  • Minimal required Dart SDK is now 2.0.0.
  • Removed log4dart because it is not dart2 compatible. Replaced it with the logging lib from pub.dart.

1.0.0 #

  • The fork removed all future-code and replaced it with async/await. The reason for that is that it can properly be used in dart2 tests.

Use this package as a library

1. Depend on it

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


dependencies:
  dherkin2: ^1.0.1+1

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.1+1 Sep 14, 2018 Go to the documentation of dherkin2 1.0.1+1 Download dherkin2 1.0.1+1 archive
1.0.1 Sep 14, 2018 Go to the documentation of dherkin2 1.0.1 Download dherkin2 1.0.1 archive
1.0.0 Jun 5, 2018 Go to the documentation of dherkin2 1.0.0 Download dherkin2 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Apr 25, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: other

Platform components identified in package: io, mirrors.

Health suggestions

Fix lib/src/model/step.dart. (-1.99 points)

Analysis of lib/src/model/step.dart reported 4 hints:

line 28 col 9: Don't explicitly initialize variables to null.

line 61 col 70: Use isNotEmpty for Iterables and Maps.

line 62 col 21: Use isNotEmpty for Iterables and Maps.

line 62 col 40: Use isNotEmpty for Iterables and Maps.

Fix lib/src/model/scenario.dart. (-1.49 points)

Analysis of lib/src/model/scenario.dart reported 3 hints:

line 23 col 87: Use = to separate a named parameter from its default value.

line 34 col 9: Use isNotEmpty for Iterables and Maps.

line 53 col 119: Use = to separate a named parameter from its default value.

Fix lib/dherkin.dart. (-1 points)

Analysis of lib/dherkin.dart reported 2 hints:

line 14 col 1: Prefer using /// for doc comments.

line 64 col 1: Prefer using /// for doc comments.

Fix additional 11 files with analysis or formatting issues. (-4.50 points)

Additional issues in the following files:

  • lib/src/gherkin_parser.dart (2 hints)
  • lib/src/model/feature.dart (2 hints)
  • lib/src/model/table.dart (2 hints)
  • lib/src/status/status.dart (2 hints)
  • lib/src/task.dart (1 hint)
  • bin/cucumberd.dart (Run dartfmt to format bin/cucumberd.dart.)
  • lib/dherkin_core.dart (Run dartfmt to format lib/dherkin_core.dart.)
  • lib/src/model/background.dart (Run dartfmt to format lib/src/model/background.dart.)
  • lib/src/model/runtime.dart (Run dartfmt to format lib/src/model/runtime.dart.)
  • lib/src/output/console_buffer.dart (Run dartfmt to format lib/src/output/console_buffer.dart.)
  • lib/src/output/output.dart (Run dartfmt to format lib/src/output/output.dart.)

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and dherkin2.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
ansicolor ^1.0.2 1.0.2
args ^1.5.0 1.5.1
logging ^0.11.3+2 0.11.3+2
Dev dependencies
build_runner ^0.10.2