Example Features

The following Features/Scenarios are included as part of the test suite

Build an example website [blueprint.feature]

As a geek I want to be automated so I can be l33t

Example Blueprint


Scenario: Example Blueprint
    Given I am a blueprint
    And I set greeting to hello
    And I set audience to world
    When I build example as .
    Then target folder . should exist
    And target file index.html should contain hello blueprint
    And target file hello.html should contain hello world

Dev Documentation [devdocs.feature]

Build as-built developer documentation

Build Feature Docs


Scenario: Build Feature Docs
    Given I am Example Features
    And I find .feature in folder ../ as files
    And I delete docs folder examples
    And I build test-plan as ../docs/examples
    Then docs file examples/index.html should exist

An Example [example.feature]

Trivial Example


@example=true
Scenario: Trivial Example
    Given I am an example
    When debug example works
    And log example works
    And error example works
    Then I succeed

Skip Broken Story


@skip=true
Scenario: Skip Broken Story
    Given I am broken
    Then I fail

Skip Debug Story


@bug=skip unless debugging
Scenario: Skip Debug Story
    Given I am a bug
    Then I fail

file handling [files.feature]

hello_world file is readable


Scenario: hello_world file is readable
    Given I am testing existing files
    And I load test from hello_world.json
    Then file hello_world.json exists
    And variable test should exist
    And $.hello in test should match world

bye_bye_world file does not exist


Scenario: bye_bye_world file does not exist
    Given I am testing missing files
    Then file bye_bye_world.json does not exist

create bye_bye_world file


Scenario: create bye_bye_world file
    Given I am testing creating files
    And I load test from hello_world.json
    And variable test should exist
    And I set test.hello to earth
    And $.hello in test should match earth
    When I write test to bye_bye_world.json
    Then file bye_bye_world.json exists

remove bye_bye_world file


Scenario: remove bye_bye_world file
    Given I am testing deleting files
    And file bye_bye_world.json exists
    And I load test from bye_bye_world.json
    When I delete file bye_bye_world.json
    Then file bye_bye_world.json does not exist

Javascript is working [jscript.feature]

Inline Javascript


Scenario: Inline Javascript
    Given I am testing javascript
    When I execute return this.targets.google.hostname=="google.com";

Multi-line Javascript


Scenario: Multi-line Javascript
    Given I am testing more javascript
    When I execute
return this.targets.google.protocol=="https";

Test Laziness [noop.feature]

Always successful


Scenario: Always successful
    Given I am testing 'pass'
    Then I pass

Wait for 1 second


Scenario: Wait for 1 second
    Given I am testing 'wait'
    And I wait 1 second
    Then I succeed

I break things


@skip=true
Scenario: I break things
    Given I am silently ignored
    Then I fail

I have a bug


@bug=JIRA_SAMPLE_ID
Scenario: I have a bug
    Given I am misbehaving
    Then I fail

I do nothing


@todo=STORY_SAMPLE_ID
Scenario: I do nothing
    Given I am a work-in-progress
    Then I fail

Variables [vars.feature]

Global Var


Scenario: Global Var
    Given I am configured
    Then bonjour should exist
    And bonjour equals monde

Config Test


Scenario: Config Test
    Given I am configured
    And I set x = ok
    Then variable x should be ok

Scoped Variable


Scenario: Scoped Variable
    Given I am scoped
    Then I assert this.vars.x=="ok"

Clear Variables


Scenario: Clear Variables
    Given I am forgetful
    And I clear variables
    Then I assert this.vars.x!="ok"

Test Variable Assignment


Scenario: Test Variable Assignment
    Given I am testing dialect
    And I set test to hello
    Then variable test should match hello

Test CSV sample using JSON-Path


Scenario: Test CSV sample using JSON-Path
    Given I am testing CSV parsing
    And some CSV as test:
what, who
hello, world
greetings, earthling
    Then $.[0].what in test should match hello
    And $.[0].who in test should match world
    And $.[1].what in test should match greetings
    And $.[1].who in test should match earthling

Test set body JSON sample - indirect via variable


Scenario: Test set body JSON sample - indirect via variable
    Given I am testing JSON
    And  I set test to JSON:
{ "hello": "world", "earth": { "moon": "cheese" } }
    Then hello in test should match world
    And earth.moon in test should match cheese
    Then I assert this.vars.test.hello=="world"
    And I assert this.vars.test.earth.moon=="cheese"

Simple HTTP [web.feature]

Google - with redirects


Scenario: Google - with redirects
    Given I am googling
    Given I enable redirects
    When I GET http://google.com
    Then response code should be 200

Google - no redirect


Scenario: Google - no redirect
    Given I am googling
    Given I disable redirects
    When I GET https://google.com
    Then response code should be 3xx

Example.com


@skip=true
@target=example
Scenario: Example.com
    Given I am googling
    Given I am browsing example.com
    When I GET http://example.com
    Then response body should contain Example Domain

404: Page Not Found [webapi.feature]

404


Scenario: 404
    Given I enable redirects
    When I GET http://localhost/404/not/found
    Then response code should be 404

Robot Web Browser [webapp.feature]

Google on Firefox


Scenario: Google on Firefox
    Given I use firefox browser
    When I visit /
    When I type wikipedia into q
    When I click btnG
    When I wait until page is linkedin - Google Search
    Then I stop using browser
    Then I page body should contain wikipedia
    Then I page body should not contain the-wrong-page

ZIP / UnZIP Files [zip.feature]

Create a zip file


Scenario: Create a zip file
    Given I am zipping-folders
    And I delete target file example.zip
    And I zip target ./ to ./example.zip
    Then target file ./example.zip exists

Inspect a zip file


Scenario: Inspect a zip file
    Given I am a unzip-test
    And target file example.zip exists
    And I read target zip example.zip
    Then variable zip.entries exists
    And any $..entryName in zip.entries should match index.html
    And any $..name in zip.entries should match index.html