2017 © Pedro Peláez
 

library codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

image

edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  • Saturday, March 31, 2018
  • by edno
  • Repository
  • 2 Watchers
  • 2 Stars
  • 2,234 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 9 Versions
  • 21 % Grown

The README.md

Gherkin Param

Latest Version Build Status Coverage Status Mutation Score License FOSSA Status, (*1)


The Codeception module for supporting parameter notation in Gherkin scenario., (*2)

Minimum Requirements

  • Codeception 3.x, 4.x, 5.x
  • PHP 7.4 - 8.2 (use release 2.0.6 for older PHP versions)

Installation

The module can be installed using Composer, (*3)

composer require edno/codeception-gherkin-param --dev

Be sure to enable the module in codeception.yml as shown in configuration below., (*4)

Setup

Enabling Gherkin Param is done in codeception.yml., (*5)

modules:
    enabled:
        - Codeception\Extension\GherkinParam

Configuration

By default GherkinParam behavior is to keep the parameter string unchanged when the replacement value for a parameter cannot be found, i.e., the parameter does not exist or is not accessible., (*6)

onErrorThrowException

If true, then GherkinParam will throw an exception GherkinParam at runtime when a replacement value cannot be found for a parameter:, (*7)

modules:
    enabled:
        - Codeception\Extension\GherkinParam:
            onErrorThrowException: true

If onErrorThrowException is set then it will override onErrorNullable., (*8)

onErrorNullable

If true, then GherkinParam will set to null parameters for which a replacement value cannot be found:, (*9)

modules:
    enabled:
        - Codeception\Extension\GherkinParam:
            onErrorNullable: true

Usage

Once installed, you will be able to access variables stored using Fixtures., (*10)

Simple parameters

In scenario steps, the variables can be accessed using the syntax {{param}}. While executing your features, the variables will be automatically replaced by their value., (*11)

Array parameters

You can refer to an element in an array using the syntax {{param[key]}}., (*12)

Test Suite Config parameters

You can refer to a test suite configuration parameter using the syntax {{config:param}}. Note that the keyword config: is mandatory., (*13)

Example

Feature: Parametrize Gherkin Feature
  In order to create a dynamic Gherkin scenario
  As a tester
  I need to be able to share data between scenario steps

  Scenario: Scenario using simple parameter
    Given I have a parameter "test" with value "42"
    Then I should see "{{test}}" equals "42"

  Scenario: Scenario using array parameter
    Given I have an array "test" with values [1, two, 3.14, IV, 101]
    Then I should see "{{test[1]}}" equals "two"

  Scenario: Scenario using config parameter
    Given I have a configuration file "acceptance.suite.yml" containing
      """
      theResponse: 42
      """
    When I execute a scenario calling the parameter 'theResponse'
    Then I should see "{{config:theResponse}}" equals "42"

The steps definition in AcceptanceTester.php do not require any change, (*14)

/**
 * @Given I have a parameter :param with value :value
 */
 public function iHaveAParameterWithValue($param, $value)
 {
   Fixtures::add($param, $value);
 }

/**
 * @Then I should see :arg1 equals :arg2
 */
 public function iSeeEqual($arg1, $arg2)
 {
   $this->assertEquals($arg1, $arg2);
 }

You can find more examples in the test folder., (*15)

Contributions

Contributions, issues, and feature requests are very welcome. If you use this package and have fixed a bug for yourself, please consider submitting a PR!, (*16)

, (*17)

Made with contributors-img., (*18)

The Versions

31/03 2018

dev-master

9999999-dev https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Greg Heitz

extension codeception gherkin

23/10 2017

dev-dev

dev-dev https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Greg Heitz

extension codeception gherkin

21/10 2017

1.0.2

1.0.2.0 https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Greg Heitz

extension codeception gherkin

03/02 2017

1.0.1

1.0.1.0 https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Greg Heitz

extension codeception gherkin

30/06 2016

1.0

1.0.0.0 https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Greg Heitz

extension codeception gherkin

11/06 2016

0.3.0

0.3.0.0 https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Greg Heitz

extension codeception gherkin

04/06 2016

0.2.1

0.2.1.0 https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Greg Heitz

extension codeception gherkin

30/05 2016

0.2.0

0.2.0.0 https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache 2.0

The Requires

 

by Greg Heitz

extension codeception gherkin

28/05 2016

0.1.0

0.1.0.0 https://github.com/edno/codeception-gherkin-param

Codeception extension for supporting parameter notation in Gherkin features

  Sources   Download

Apache 2.0

The Requires

 

by Greg Heitz

extension codeception gherkin