2017 © Pedro Peláez
 

behat-extension behatclipboard

image

timitao/behatclipboard

  • Tuesday, April 14, 2015
  • by timiTao
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5,800 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

License Latest Stable Version Latest Unstable Version Total Downloads SensioLabsInsight Scrutinizer Code Quality Build Status, (*1)

BehatClipboard

BehatClipboard is an integration layer between contexts in Behat 3.0+ and it provides:, (*2)

  • Additional service for Behat Clipboard,
  • base Behat\ClipboardExtension\Context\FeatureContext context which provides base step definitions for your contexts,
  • allow to share data between contexts - all,
  • allow to use keys, in scenarios - and will be replaced, in: ** TableNode ** PyString ** Value

Purpose of this is that, I'm testing REST API. In return I get JSON that want call universal way. I'm saving last respond to clipboard and freely call this by clipboard(last_response.body.KEY.KEY.KEY), (*3)

Flow

System generate a container that hold data. We could save there and read inside context. Clipboard will we shared between all context that implement interface Behat\ClipboardExtension\Context\ClipboardContextAwareInterface;, (*4)

Extension add event for transform data in scenario with given prefix and pattern., (*5)

In default, it will look for example: clipboard(test1), where test1 is key from clipboard and replace in scenario before execute step. The transform not depend on given context., (*6)

Given Clipboard save the value "10" on key "test1"
#in next step clipboard.test1 will be transformed to 10, and send to step
And Clipboard over key "clipboard(test1)" have "10" 

Minimum functionality you need to implement in your context is saving to clipboard. Like in Behat\ClipboardExtension\Context\FeatureContext:, (*7)

/**
 * @Then Clipboard save the value :arg1 on key :arg2
 *
 * @param $arg1
 * @param $arg2
 */
public function clipboardSaveTheValueOnKey($arg1, $arg2)
{
    $this->clipboard->set($arg2, $arg1);
}

Installing extension

The easiest way to install is by using Composer:, (*8)

$> curl -sS https://getcomposer.org/installer | php
$> php composer.phar require timitao/behatclipboard='1.0.*'

or composer.json, (*9)

"require": {
    "timitao/behatclipboard": "1.0.*"
},

Action

Base context allow: * save value on key to clipboard * check containing KEY by clipboard * copy from KEY1 to KEY2 * save multi values by TableNode * save PyString by key, (*10)

Examples

Look at this clipboard.feature, (*11)

Default

We can define default values for clipboard by:, (*12)

extensions:
    Behat\ClipboardExtension\ClipboardExtension:
        defaults:
            key1: value1
            key2.key2 : value2

Extra

Additionally, it assist dotNotification., (*13)

If you save array on [test=>[test2=>15]] in scenario, you could call this by * clipboard(test1) to get [test2=>15] * clipboard(test.test2) to get 15, (*14)

Configuration

Actually used configuration: * prefix - prefix for recognise data in scenario to replace. Default: clipboard * pattern - pattern that will be complete with prefix and looking data to transform from clipboard. Default: /%s\(([a-zA-Z0-9_\.\-]+)\)/, (*15)

Suggestion

Suggested to use with Behat Assert Context., (*16)

Versioning

Staring version 1.0.0, will follow Semantic Versioning v2.0.0., (*17)

Contributors

  • Tomasz Kunicki TimiTao [lead developer]

The Versions

14/04 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

test extension behat gui

14/04 2015

v1.0.6

1.0.6.0

  Sources   Download

MIT

The Requires

 

test extension behat gui

17/12 2014

v1.0.5

1.0.5.0

  Sources   Download

MIT

The Requires

 

test extension behat gui

17/12 2014

v1.0.4

1.0.4.0

  Sources   Download

MIT

The Requires

 

test extension behat gui

17/12 2014

v1.0.3

1.0.3.0

  Sources   Download

MIT

The Requires

 

test extension behat gui

17/12 2014

v1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

 

test extension behat gui

17/12 2014

v1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

test extension behat gui

17/12 2014

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

test extension behat gui

25/11 2014

v0.5

0.5.0.0

  Sources   Download

MIT

The Requires

 

test extension behat gui