Code Monkey home page Code Monkey logo

behatch-contexts's Introduction

Behatch contexts

Build status

Behatch contexts provide most common behat tests.

Installation

This extension requires:

  • Behat 2.4+
  • Mink 1.4+
  • Mink extension

Through PHAR

Download the .phar archives:

And activate it in your in your behat.yml:

# behat.yml
default:
    # ...
    extensions:
        behatch_contexts.phar: ~

Through Composer

The easiest way to keep your suite updated is to use Composer.

You can add behatch contexts as dependancies for your project or rapidly bootstrap a behatch projects.

Project dependancy

  1. Define dependencies in your composer.json:
{
    "require": {
        ...

        "sanpi/behatch-contexts": "*"
    }
}
  1. Install/update your vendors:
$ curl http://getcomposer.org/installer | php
$ php composer.phar install
  1. Activate extension by specifying its class in your behat.yml:
# behat.yml
default:
    # ...
    extensions:
        Sanpi\Behatch\Extension: ~

Project boostraping

  1. Download the behatch skeleton with composer:
$ curl http://getcomposer.org/installer | php
$ php composer.phar create-project sanpi/behatch-skeleton

Note

Browser, json, table and rest step need a mink configuration, see Mink extension for more informations.

Usage

In your main context, using behatch contexts:

<?php

use Behat\Behat\Context\BehatContext;
use Sanpi\Behatch\Context\BehatchContext;

class FeatureContext extends BehatContext
{
    public function __construct(array $parameters)
    {
        $this->useContext('behatch', new BehatchContext($parameters));
    }
}

After this, you wouldn't have new available step. You should enable, in behat.yml, the desired steps group:

Sanpi\Behatch\Extension:
    contexts:
        browser: ~
        debug: ~
        system: ~
        json: ~
        table: ~
        rest: ~
        xml: ~

Configuration

  • browser - more browser related steps (like mink)
  • debug - helper steps for debuging
    • screenshot_dir - the directory where store screenshots
    • screen_id - then xorg screen id
  • system - shell related steps
    • root - the root directory of the filesystem
  • json - JSON related steps
    • evaluation_mode - javascript "foo.bar" or php "foo->bar"
  • table - play with HTML the tables
  • rest - send GET, POST, โ€ฆ requests and test the HTTP headers
  • xml - XML related steps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.