Skip to content

Instantly share code, notes, and snippets.

@DavertMik
Created September 27, 2012 20:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavertMik/3796226 to your computer and use it in GitHub Desktop.
Save DavertMik/3796226 to your computer and use it in GitHub Desktop.
Codeception RFC - Herkin language =)

Herkin new awesome language for writing tests RFC

Action

PHP

$I->click('Hello');

Herkin

I click "Hello"

Action with Additional Params

PHP

$I->see('Hello', 'h1');

Herkin

I see "Hello" in "h1"
I see "Hello" within "h1"
I see "Hello" inside "h1"
I see "Hello" word inside "h1"

Use any words to separate parameters as long as you are using quotes to match them.

More Gherkin

PHP

$I->see('Hello');

HERKIN

Then I see "Hello"

Use "Then" word at begining of assertion. If you like

Mix it Up!

PHP

<?php
$I = new WebGuy($scenario);
$I->wantTo('log into website');
$I->amOnPage('/');
$I->click('Log In');
$I->fillField('username', 'davert');
$I->fillField('password','123456');
$I->click('Submit');
$I->see('Hello, davert');
?>

HERKIN

log into website
---

I am on page "/"
I click "Log In"
I fill field "username" with "davert"
I fill field "password" with "123456"
I click "Submit"
I see "Hello, davert"

HERKIN extended to GHERKIN

log into website
---

As a web site user
I want to login to website
In order to get more options

Given I am on page "/"
When I click "Log In"
And I fill field "username" with "davert"
And I fill field "password" with "123456"
And I click "Submit"
Then I see "Hello, davert"
@ipeevski
Copy link

I like it. Any chance becoming a reality?

@micaweb
Copy link

micaweb commented Feb 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment