2017 © Pedro Peláez
 

library behat-test-runner

Component to help in self testing Behat extension development

image

bex/behat-test-runner

Component to help in self testing Behat extension development

  • Friday, May 20, 2016
  • by elvetemedve
  • Repository
  • 2 Watchers
  • 2 Stars
  • 943 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Behat Test Runner

Build Status, (*1)

Behat Test Runner is essentially a Behat context class which provides steps for testing a Behat extension. You can put together a feature file and behat.yml configuration, than the test runner will start a second Behat process to evaluate the created feature file., (*2)

Installation

Install by adding to your composer.json:, (*3)

composer require --dev bex/behat-test-runner

Configuration

Include the context file in behat.yml like this:, (*4)

default:
  suites:
    default:
      contexts:
        - Bex\Behat\Context\TestRunnerContext

You can configure the test web browser to be used for opening the pages, like this (optional):, (*5)

default:
  suites:
    default:
      contexts:
        - Bex\Behat\Context\TestRunnerContext:
            browserCommand: %paths.base%/bin/phantomjs --webdriver=4444

You can configure the working directory like this (optional):, (*6)

default:
  suites:
    default:
      contexts:
        - Bex\Behat\Context\TestRunnerContext:
            workingDirectory: path/to/your/working/dir # if not provided then a temporary working dir is autogenerated

Usage

Simply use the necessary steps from the context file to put together your feature., (*7)

An example:, (*8)

Feature: Visiting a page on the website
    In order to demonstrate how to use test runner
    As a developer
    I should open a page and verify the content of it

    Scenario: Visiting the index.html page
        Given I have the file "index.html" in document root:
            """
            <!DOCTYPE html>
            <html>
              <head>
                  <meta charset="UTF-8">
                  <title>Test page</title>
              </head>
              <body>
                  <h1>Lorem ipsum dolor amet.</h1>
              </body>
            </html>
            """
        And I have a web server running on host "localhost" and port "8080"
        And I have the feature:
            """
            Feature: Test runner demo feature
                Scenario:
                    Given I open the index page
                    Then I should see the content "Lorem ipsum" on the page
            """
        And I have the context:
            """
            <?php
            use Behat\MinkExtension\Context\RawMinkContext;
            class FeatureContext extends RawMinkContext
            {
                /**
                 * @Given I open the index page
                 */
                function firstStep()
                {
                    $this->visitPath('index.html');
                }
                /**
                 * @Then I should see the content :content on the page
                 */
                function secondStep($content)
                {
                   $this->getMink()->assertElementContains('h1', $content);
                }
            }
            """
        When I run Behat
        Then I should not see a failing test

The Versions

20/05 2016

dev-master

9999999-dev https://github.com/elvetemedve/behat-test-runner

Component to help in self testing Behat extension development

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd extension behat

20/05 2016

1.2.1

1.2.1.0 https://github.com/elvetemedve/behat-test-runner

Component to help in self testing Behat extension development

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd extension behat

19/05 2016

1.2.0

1.2.0.0 https://github.com/elvetemedve/behat-test-runner

Component to help in self testing Behat extension development

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd extension behat

14/05 2016

dev-feature/add-cli-options-to-php

dev-feature/add-cli-options-to-php https://github.com/elvetemedve/behat-test-runner

Component to help in self testing Behat extension development

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd extension behat

17/11 2015

1.1.1

1.1.1.0 https://github.com/elvetemedve/behat-test-runner

Component to help in self testing Behat extension development

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd extension behat

16/11 2015

1.1.0

1.1.0.0 https://github.com/elvetemedve/behat-test-runner

Component to help in self testing Behat extension development

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd extension behat

13/11 2015

1.0.0

1.0.0.0 https://github.com/elvetemedve/behat-test-runner

Component to help in self testing Behat extension development

  Sources   Download

MIT

The Requires

 

The Development Requires

bdd tdd extension behat