Created
July 25, 2012 22:54
-
-
Save stof/3179214 to your computer and use it in GitHub Desktop.
Behat failures on windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
...F................................................................................................F....................................................................F....F....F....F....F.....................F....F....F-..................................................................................................F......F.........................................................................................................................................................................................................................................................F.....F.....F.......................................................................................................................................................................................................................... | |
(::) failed steps (::) | |
01. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
'<?php | |
require_once 'PHPUnit/Autoload.php'; | |
require_once 'PHPUnit/Framework/Assert/Functions.php'; | |
use Behat\Behat\Context\BehatContext, | |
Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode, | |
Behat\Gherkin\Node\TableNode; | |
class FeatureContext extends BehatContext | |
{ | |
private $apples = 0; | |
private $parameters; | |
public function __construct(array $parameters) { | |
$this->parameters = $parameters; | |
} | |
/** | |
* @Given /^I have (\d+) apples?$/ | |
*/ | |
public function iHaveApples($count) { | |
$this->apples = intval($count); | |
} | |
/** | |
* @When /^I ate (\d+) apples?$/ | |
*/ | |
public function iAteApples($count) { | |
$this->apples -= intval($count); | |
} | |
/** | |
* @When /^I found (\d+) apples?$/ | |
*/ | |
public function iFoundApples($count) { | |
$this->apples += intval($count); | |
} | |
/** | |
* @Then /^I should have (\d+) apples$/ | |
*/ | |
public function iShouldHaveApples($count) { | |
assertEquals(intval($count), $this->apples); | |
} | |
/** | |
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/ | |
*/ | |
public function contextParameterShouldBeEqualTo($key, $val) { | |
assertEquals($val, $this->parameters[$key]); | |
} | |
/** | |
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/ | |
*/ | |
public function contextParameterShouldBeArrayWithElements($key, $count) { | |
assertInternalType('array', $this->parameters[$key]); | |
assertEquals(2, count($this->parameters[$key])); | |
} | |
private function doSomethingUndefinedWith() {} | |
/** | |
* @Given /^do something undefined with \$$/ | |
*/ | |
public function doSomethingUndefinedWith2() | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^do something undefined with \\(\d+)$/ | |
*/ | |
public function doSomethingUndefinedWith3($arg1) | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^pystring:$/ | |
*/ | |
public function pystring(PyStringNode $string) | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^pystring (\d+):$/ | |
*/ | |
public function pystring2($arg1, PyStringNode $string) | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^table:$/ | |
*/ | |
public function table(TableNode $table) | |
{ | |
throw new PendingException(); | |
} | |
}' | |
In step `And "features/bootstrap/FeatureContext.php" file should contain:'. # FeatureContext::fileShouldContain() | |
From scenario `Run feature with failing scenarios'. # features\annotations\append_snippets.feature:123 | |
02. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
-'C:\Users\Christophe COEVOET\AppData\Local\Temp\behat\5b9f1a63ac4541cf92113ed1936de855/features/apples.feature:9 | |
-C:\Users\Christophe COEVOET\AppData\Local\Temp\behat\5b9f1a63ac4541cf92113ed1936de855/features/apples.feature:22' | |
+'C:\Users\Christophe COEVOET\AppData\Local\Temp\behat\5b9f1a63ac4541cf92113ed1936de855\features\apples.feature:9 | |
+C:\Users\Christophe COEVOET\AppData\Local\Temp\behat\5b9f1a63ac4541cf92113ed1936de855\features\apples.feature:22' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Run feature with failing scenarios'. # features\annotations\failed_formatter.feature:116 | |
03. Failed asserting that '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns ="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<title>Behat Test Suite</title> | |
<style type="text/css"> | |
body { | |
margin:0px; | |
padding:0px; | |
position:relative; | |
padding-top:75px; | |
} | |
#behat { | |
float:left; | |
font-family: Georgia, serif; | |
font-size:18px; | |
line-height:26px; | |
width:100%; | |
} | |
#behat .statistics { | |
float:left; | |
width:100%; | |
margin-bottom:15px; | |
} | |
#behat .statistics p { | |
text-align:right; | |
padding:5px 15px; | |
margin:0px; | |
border-right:10px solid #000; | |
} | |
#behat .statistics.failed p { | |
border-color:#C20000; | |
} | |
#behat .statistics.passed p { | |
border-color:#3D7700; | |
} | |
#behat .feature { | |
margin:15px; | |
} | |
#behat h2, #behat h3, #behat h4 { | |
margin:0px 0px 5px 0px; | |
padding:0px; | |
font-family:Georgia; | |
} | |
#behat h2 .title, #behat h3 .title, #behat h4 .title { | |
font-weight:normal; | |
} | |
#behat .path { | |
font-size:10px; | |
font-weight:normal; | |
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace !important; | |
color:#999; | |
padding:0px 5px; | |
float:right; | |
} | |
#behat .path a:link, | |
#behat .path a:visited { | |
color:#999; | |
} | |
#behat .path a:hover, | |
#behat .path a:active { | |
background-color:#000; | |
color:#fff; | |
} | |
#behat h3 .path { | |
margin-right:4%; | |
} | |
#behat ul.tags { | |
font-size:14px; | |
font-weight:bold; | |
color:#246AC1; | |
list-style:none; | |
margin:0px; | |
padding:0px; | |
} | |
#behat ul.tags li { | |
display:inline; | |
} | |
#behat ul.tags li:after { | |
content:' '; | |
} | |
#behat ul.tags li:last-child:after { | |
content:''; | |
} | |
#behat .feature > p { | |
margin-top:0px; | |
margin-left:20px; | |
} | |
#behat .scenario { | |
margin-left:20px; | |
margin-bottom:20px; | |
} | |
#behat .scenario > ol, | |
#behat .scenario .examples > ol { | |
margin:0px; | |
list-style:none; | |
padding:0px; | |
} | |
#behat .scenario > ol { | |
margin-left:20px; | |
} | |
#behat .scenario > ol:after, | |
#behat .scenario .examples > ol:after { | |
content:''; | |
display:block; | |
clear:both; | |
} | |
#behat .scenario > ol li, | |
#behat .scenario .examples > ol li { | |
float:left; | |
width:95%; | |
padding-left:5px; | |
border-left:5px solid; | |
margin-bottom:4px; | |
} | |
#behat .scenario > ol li .argument, | |
#behat .scenario .examples > ol li .argument { | |
margin:10px 20px; | |
font-size:16px; | |
overflow:hidden; | |
} | |
#behat .scenario > ol li table.argument, | |
#behat .scenario .examples > ol li table.argument { | |
border:1px solid #d2d2d2; | |
} | |
#behat .scenario > ol li table.argument thead td, | |
#behat .scenario .examples > ol li table.argument thead td { | |
font-weight: bold; | |
} | |
#behat .scenario > ol li table.argument td, | |
#behat .scenario .examples > ol li table.argument td { | |
padding:5px 10px; | |
background:#f3f3f3; | |
} | |
#behat .scenario > ol li .keyword, | |
#behat .scenario .examples > ol li .keyword { | |
font-weight:bold; | |
} | |
#behat .scenario > ol li .path, | |
#behat .scenario .examples > ol li .path { | |
float:right; | |
} | |
#behat .scenario .examples { | |
margin-top:20px; | |
margin-left:40px; | |
} | |
#behat .scenario .examples h4 span { | |
font-weight:normal; | |
background:#f3f3f3; | |
color:#999; | |
padding:0 5px; | |
margin-left:10px; | |
} | |
#behat .scenario .examples table { | |
margin-left:20px; | |
} | |
#behat .scenario .examples table thead td { | |
font-weight:bold; | |
text-align:center; | |
} | |
#behat .scenario .examples table td { | |
padding:2px 10px; | |
font-size:16px; | |
} | |
#behat .scenario .examples table .failed.exception td { | |
border-left:5px solid #000; | |
border-color:#C20000 !important; | |
padding-left:0px; | |
} | |
pre { | |
font-family:monospace; | |
} | |
.snippet { | |
font-size:14px; | |
color:#000; | |
margin-left:20px; | |
} | |
.backtrace { | |
font-size:12px; | |
line-height:18px; | |
color:#000; | |
overflow:hidden; | |
margin-left:20px; | |
padding:15px; | |
border-left:2px solid #C20000; | |
background: #fff; | |
margin-right:15px; | |
} | |
#behat .passed { | |
background:#DBFFB4; | |
border-color:#65C400 !important; | |
color:#3D7700; | |
} | |
#behat .failed { | |
background:#FFFBD3; | |
border-color:#C20000 !important; | |
color:#C20000; | |
} | |
#behat .undefined, #behat .pending { | |
border-color:#FAF834 !important; | |
background:#FCFB98; | |
color:#000; | |
} | |
#behat .skipped { | |
background:lightCyan; | |
border-color:cyan !important; | |
color:#000; | |
} | |
#behat .summary { | |
position: absolute; | |
top: 0px; | |
left: 0px; | |
width:100%; | |
font-family: Arial, sans-serif; | |
font-size: 14px; | |
line-height: 18px; | |
} | |
#behat .summary .counters { | |
padding: 10px; | |
border-top: 0px; | |
border-bottom: 0px; | |
border-right: 0px; | |
border-left: 5px; | |
border-style: solid; | |
height: 52px; | |
overflow: hidden; | |
} | |
#behat .summary .switchers { | |
position: absolute; | |
right: 15px; | |
top: 25px; | |
} | |
#behat .summary .switcher { | |
text-decoration: underline; | |
cursor: pointer; | |
} | |
#behat .summary .switchers a { | |
margin-left: 10px; | |
color: #000; | |
} | |
#behat .summary .switchers a:hover { | |
text-decoration:none; | |
} | |
#behat .summary p { | |
margin:0px; | |
} | |
#behat .jq-toggle > .scenario, | |
#behat .jq-toggle > ol, | |
#behat .jq-toggle > .examples { | |
display:none; | |
} | |
#behat .jq-toggle-opened > .scenario, | |
#behat .jq-toggle-opened > ol, | |
#behat .jq-toggle-opened > .examples { | |
display:block; | |
} | |
#behat .jq-toggle > h2, | |
#behat .jq-toggle > h3 { | |
cursor:pointer; | |
} | |
#behat .jq-toggle > h2:after, | |
#behat .jq-toggle > h3:after { | |
content:' |+'; | |
font-weight:bold; | |
} | |
#behat .jq-toggle-opened > h2:after, | |
#behat .jq-toggle-opened > h3:after { | |
content:' |-'; | |
font-weight:bold; | |
} | |
</style> | |
<style type="text/css" media="print"> | |
body { | |
padding:0px; | |
} | |
#behat { | |
font-size:11px; | |
} | |
#behat .jq-toggle > .scenario, | |
#behat .jq-toggle > .scenario .examples, | |
#behat .jq-toggle > ol { | |
display:block; | |
} | |
#behat .summary { | |
position:relative; | |
} | |
#behat .summary .counters { | |
border:none; | |
} | |
#behat .summary .switchers { | |
display:none; | |
} | |
#behat .step .path { | |
display:none; | |
} | |
#behat .jq-toggle > h2:after, | |
#behat .jq-toggle > h3:after { | |
content:''; | |
font-weight:bold; | |
} | |
#behat .jq-toggle-opened > h2:after, | |
#behat .jq-toggle-opened > h3:after { | |
content:''; | |
font-weight:bold; | |
} | |
#behat .scenario > ol li, | |
#behat .scenario .examples > ol li { | |
border-left:none; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="behat"> | |
<div class="feature"> | |
<h2> | |
<span class="keyword">Feature: </span> | |
<span class="title">World consistency</span> | |
</h2> | |
<p> | |
In order to maintain stable behaviors<br /> | |
As a features developer<br /> | |
I want, that "World" flushes between scenarios<br /> | |
</p> | |
<div class="scenario"> | |
<h3> | |
<span class="keyword">Scenario: </span> | |
<span class="title">Nothing</span> | |
<span class="path">features\World.feature:6</span> | |
</h3> | |
<ol> | |
<li class="passed"> | |
<div class="step"> | |
<span class="keyword">Given </span> | |
<span class="text">I have entered <strong class="passed_param">10</strong></span> | |
<span class="path"><a href="http://localhost/features\bootstrap\FeatureContext.php">FeatureContext::iHaveEntered()</a></span> | |
</div> | |
</li> | |
</ol> | |
</div> | |
</div> | |
<div class="summary passed"> | |
<div class="counters"> | |
<p class="scenarios"> | |
1 scenario (<strong class="passed">1 passed</strong>) | |
</p> | |
<p class="steps"> | |
1 step (<strong class="passed">1 passed</strong>) | |
</p> | |
</div> | |
<div class="switchers"> | |
<a href="javascript:void(0)" id="behat_show_all">[+] all</a> | |
<a href="javascript:void(0)" id="behat_hide_all">[-] all</a> | |
</div> | |
</div> | |
</div> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#behat .feature h2').click(function(){ | |
$(this).parent().toggleClass('jq-toggle-opened'); | |
}).parent().addClass('jq-toggle'); | |
$('#behat .scenario h3').click(function(){ | |
$(this).parent().toggleClass('jq-toggle-opened'); | |
}).parent().addClass('jq-toggle'); | |
$('#behat_show_all').click(function(){ | |
$('#behat .feature').addClass('jq-toggle-opened'); | |
$('#behat .scenario').addClass('jq-toggle-opened'); | |
}); | |
$('#behat_hide_all').click(function(){ | |
$('#behat .feature').removeClass('jq-toggle-opened'); | |
$('#behat .scenario').removeClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .scenarios .passed') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:not(:has(.failed, .pending))'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .steps .passed') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.passed)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .failed') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.failed)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .skipped') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.skipped)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .pending') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.pending)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
}); | |
</script> | |
</body> | |
</html>' contains "<div class="scenario"> | |
<h3> | |
<span class="keyword">Scenario: </span> | |
<span class="title">Nothing</span> | |
<span class="path">features\World.feature:6</span> | |
</h3> | |
<ol> | |
<li class="passed"> | |
<div class="step"> | |
<span class="keyword">Given </span> | |
<span class="text">I have entered <strong class="passed_param">10</strong></span> | |
<span class="path"><a href="http://localhost/features/bootstrap/FeatureContext.php">FeatureContext::iHaveEntered()</a></span> | |
</div> | |
</li> | |
</ol> | |
</div>". | |
In step `Then the output should contain:'. # FeatureContext::theOutputShouldContain() | |
From scenario `Links to step definitions relative to a remote base'. # features\annotations\html_format.feature:367 | |
04. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
/** | |
- * @Given /^Добавить "([^"]*)" число$/ | |
+ * @Given /^Доба�(\d+)ить "([^"]*)" число$/ | |
*/ | |
- public function dobavitChislo($arg1) | |
+ public function stepDefinition1($arg1, $arg2) | |
{ | |
throw new PendingException(); | |
}' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Pretty'. # features\annotations\i18n.feature:92 | |
05. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
/** | |
- * @Given /^Добавить "([^"]*)" число$/ | |
+ * @Given /^Доба�(\d+)ить "([^"]*)" число$/ | |
*/ | |
- public function dobavitChislo($arg1) | |
+ public function stepDefinition1($arg1, $arg2) | |
{ | |
throw new PendingException(); | |
}' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Progress'. # features\annotations\i18n.feature:147 | |
06. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
/** | |
- * @Given /^Добавить "([^"]*)" число$/ | |
+ * @Given /^Доба�(\d+)ить "([^"]*)" число$/ | |
*/ | |
- public function dobavitChislo($arg1) | |
+ public function stepDefinition1($arg1, $arg2) | |
{ | |
throw new PendingException(); | |
}' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Progress with unexisting locale'. # features\annotations\i18n.feature:187 | |
07. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
/** | |
- * @Given /^Добавить "([^"]*)" число$/ | |
+ * @Given /^Доба�(\d+)ить "([^"]*)" число$/ | |
*/ | |
- public function dobavitChislo($arg1) | |
+ public function stepDefinition1($arg1, $arg2) | |
{ | |
throw new PendingException(); | |
}' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Progress with unexisting locale'. # features\annotations\i18n.feature:227 | |
08. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
'Feature: Apples story | |
+ | |
In order to eat apple | |
+ | |
As a little kid | |
+ | |
I need to have an apple in my pocket | |
+ | |
Background: | |
+ | |
Given I have 3 apples | |
+ | |
Scenario: I'm little hungry | |
+ | |
When I ate 1 apple | |
+ | |
Then I should have 3 apples | |
+ | |
Failed asserting that 2 matches expected 3. | |
+ | |
Scenario: Found more apples | |
+ | |
When I found 5 apples | |
+ | |
Then I should have 8 apples | |
+ | |
Scenario: Found more apples | |
+ | |
When I found 2 apples | |
+ | |
Then I should have 5 apples | |
+ | |
And do something undefined | |
+ | |
Scenario Outline: Other situations | |
+ | |
When I ate <ate> apples | |
+ | |
And I found <found> apples | |
+ | |
Then I should have <result> apples | |
+ | |
Examples: | |
+ | |
| ate | found | result | | |
+ | |
| 3 | 1 | 1 | | |
+ | |
| 0 | 4 | 8 | | |
+ | |
Failed asserting that 7 matches expected 8. | |
+ | |
| 2 | 2 | 3 | | |
+ | |
Scenario: Multilines | |
+ | |
Given pystring: | |
+ | |
And table: | |
+ | |
7 scenarios (3 passed, 2 undefined, 2 failed) | |
+ | |
25 steps (20 passed, 3 undefined, 2 failed) | |
+ | |
You can implement step definitions for undefined steps with these snippets: | |
/** | |
* @Given /^do something undefined$/ | |
*/ | |
public function doSomethingUndefined() | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^pystring:$/ | |
*/ | |
public function pystring(PyStringNode $string) | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^table:$/ | |
*/ | |
public function table(TableNode $table) | |
{ | |
throw new PendingException(); | |
}' | |
In step `And "apples.pretty" file should contain:'. # FeatureContext::fileShouldContain() | |
From scenario `2 formats, write first to file'. # features\annotations\multiple_formats.feature:342 | |
09. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
'..F......U.......F.....UU | |
(::) failed steps (::) | |
01. Failed asserting that 2 matches expected 3. | |
+ | |
In step `Then I should have 3 apples'. # FeatureContext::iShouldHaveApples() | |
- From scenario `I'm little hungry'. # features/apples.feature:9 | |
+ From scenario `I'm little hungry'. # features\apples.feature:9 | |
+ | |
+ | |
02. Failed asserting that 7 matches expected 8. | |
+ | |
In step `Then I should have 8 apples'. # FeatureContext::iShouldHaveApples() | |
- From scenario `Other situations'. # features/apples.feature:22 | |
+ From scenario `Other situations'. # features\apples.feature:22 | |
+ | |
+ | |
7 scenarios (3 passed, 2 undefined, 2 failed) | |
+ | |
25 steps (20 passed, 3 undefined, 2 failed) | |
+ | |
You can implement step definitions for undefined steps with these snippets: | |
/** | |
* @Given /^do something undefined$/ | |
*/ | |
public function doSomethingUndefined() | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^pystring:$/ | |
*/ | |
public function pystring(PyStringNode $string) | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^table:$/ | |
*/ | |
public function table(TableNode $table) | |
{ | |
throw new PendingException(); | |
}' | |
In step `And "apples.progress" file should contain:'. # FeatureContext::fileShouldContain() | |
From scenario `2 formats, write second to file'. # features\annotations\multiple_formats.feature:457 | |
10. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
'Feature: Apples story | |
+ | |
In order to eat apple | |
+ | |
As a little kid | |
+ | |
I need to have an apple in my pocket | |
+ | |
Background: | |
+ | |
Given I have 3 apples | |
+ | |
Scenario: I'm little hungry | |
+ | |
When I ate 1 apple | |
+ | |
Then I should have 3 apples | |
+ | |
Failed asserting that 2 matches expected 3. | |
+ | |
Scenario: Found more apples | |
+ | |
When I found 5 apples | |
+ | |
Then I should have 8 apples | |
+ | |
Scenario: Found more apples | |
+ | |
When I found 2 apples | |
+ | |
Then I should have 5 apples | |
+ | |
And do something undefined | |
+ | |
Scenario Outline: Other situations | |
+ | |
When I ate <ate> apples | |
+ | |
And I found <found> apples | |
+ | |
Then I should have <result> apples | |
+ | |
Examples: | |
+ | |
| ate | found | result | | |
+ | |
| 3 | 1 | 1 | | |
+ | |
| 0 | 4 | 8 | | |
+ | |
Failed asserting that 7 matches expected 8. | |
+ | |
| 2 | 2 | 3 | | |
+ | |
Scenario: Multilines | |
+ | |
Given pystring: | |
+ | |
And table: | |
+ | |
7 scenarios (3 passed, 2 undefined, 2 failed) | |
+ | |
25 steps (20 passed, 3 undefined, 2 failed) | |
+ | |
You can implement step definitions for undefined steps with these snippets: | |
/** | |
* @Given /^do something undefined$/ | |
*/ | |
public function doSomethingUndefined() | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^pystring:$/ | |
*/ | |
public function pystring(PyStringNode $string) | |
{ | |
throw new PendingException(); | |
} | |
/** | |
* @Given /^table:$/ | |
*/ | |
public function table(TableNode $table) | |
{ | |
throw new PendingException(); | |
}' | |
In step `And "app.pretty" file should contain:'. # FeatureContext::fileShouldContain() | |
From scenario `2 formats, write both to files'. # features\annotations\multiple_formats.feature:572 | |
11. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
-'..F.......F.... | |
+'[InvalidArgumentException] | |
+ Can't find loader for resource: C:\Users\Christophe COEVOET\AppData\Local\Temp\behat\1db166451174bd7c7bfacc9c9d7b591b\features\apples.feature:9 | |
-(::) failed steps (::) | |
-01. Failed asserting that 2 matches expected 3. | |
- In step `Then I should have 3 apples'. # FeatureContext::iShouldHaveApples() | |
- From scenario `I'm little hungry'. # features\apples.feature:9 | |
-02. Failed asserting that 7 matches expected 8. | |
- In step `Then I should have 8 apples'. # FeatureContext::iShouldHaveApples() | |
- From scenario `Other situations'. # features\apples.feature:21 | |
- | |
-4 scenarios (2 passed, 2 failed) | |
-15 steps (13 passed, 2 failed)' | |
+behat [--init] [-f|--format="..."] [--out="..."] [--lang="..."] [--[no-]ansi] [--[no-]time] [--[no-]paths] [--[no-]snippets] [--[no-]snippets-paths] [--[no-]multiline] [--[no-]expand] [--story-syntax] [-d|--definitions="..."] [--name="..."] [--tags="..."] [--cache="..."] [--strict] [--dry-run] [--rerun="..."] [--append-snippets] [features]' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Rerun only failed scenarios'. # features\annotations\rerun.feature:126 | |
12. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
-'..F | |
+'[InvalidArgumentException] | |
+ Can't find loader for resource: C:\Users\Christophe COEVOET\AppData\Local\Temp\behat\0c2e110ef4d40da332626d530f589ce1\features\apples.feature:9 | |
-(::) failed steps (::) | |
-01. Failed asserting that 2 matches expected 3. | |
- In step `Then I should have 3 apples'. # FeatureContext::iShouldHaveApples() | |
- From scenario `I'm little hungry'. # features\apples.feature:9 | |
-1 scenario (1 failed) | |
-3 steps (2 passed, 1 failed)' | |
+behat [--init] [-f|--format="..."] [--out="..."] [--lang="..."] [--[no-]ansi] [--[no-]time] [--[no-]paths] [--[no-]snippets] [--[no-]snippets-paths] [--[no-]multiline] [--[no-]expand] [--story-syntax] [-d|--definitions="..."] [--name="..."] [--tags="..."] [--cache="..."] [--strict] [--dry-run] [--rerun="..."] [--append-snippets] [features]' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Fixing scenario removes it from the rerun log'. # features\annotations\rerun.feature:147 | |
13. Failed asserting that '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns ="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<title>Behat Test Suite</title> | |
<style type="text/css"> | |
body { | |
margin:0px; | |
padding:0px; | |
position:relative; | |
padding-top:75px; | |
} | |
#behat { | |
float:left; | |
font-family: Georgia, serif; | |
font-size:18px; | |
line-height:26px; | |
width:100%; | |
} | |
#behat .statistics { | |
float:left; | |
width:100%; | |
margin-bottom:15px; | |
} | |
#behat .statistics p { | |
text-align:right; | |
padding:5px 15px; | |
margin:0px; | |
border-right:10px solid #000; | |
} | |
#behat .statistics.failed p { | |
border-color:#C20000; | |
} | |
#behat .statistics.passed p { | |
border-color:#3D7700; | |
} | |
#behat .feature { | |
margin:15px; | |
} | |
#behat h2, #behat h3, #behat h4 { | |
margin:0px 0px 5px 0px; | |
padding:0px; | |
font-family:Georgia; | |
} | |
#behat h2 .title, #behat h3 .title, #behat h4 .title { | |
font-weight:normal; | |
} | |
#behat .path { | |
font-size:10px; | |
font-weight:normal; | |
font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', Monaco, Courier, monospace !important; | |
color:#999; | |
padding:0px 5px; | |
float:right; | |
} | |
#behat .path a:link, | |
#behat .path a:visited { | |
color:#999; | |
} | |
#behat .path a:hover, | |
#behat .path a:active { | |
background-color:#000; | |
color:#fff; | |
} | |
#behat h3 .path { | |
margin-right:4%; | |
} | |
#behat ul.tags { | |
font-size:14px; | |
font-weight:bold; | |
color:#246AC1; | |
list-style:none; | |
margin:0px; | |
padding:0px; | |
} | |
#behat ul.tags li { | |
display:inline; | |
} | |
#behat ul.tags li:after { | |
content:' '; | |
} | |
#behat ul.tags li:last-child:after { | |
content:''; | |
} | |
#behat .feature > p { | |
margin-top:0px; | |
margin-left:20px; | |
} | |
#behat .scenario { | |
margin-left:20px; | |
margin-bottom:20px; | |
} | |
#behat .scenario > ol, | |
#behat .scenario .examples > ol { | |
margin:0px; | |
list-style:none; | |
padding:0px; | |
} | |
#behat .scenario > ol { | |
margin-left:20px; | |
} | |
#behat .scenario > ol:after, | |
#behat .scenario .examples > ol:after { | |
content:''; | |
display:block; | |
clear:both; | |
} | |
#behat .scenario > ol li, | |
#behat .scenario .examples > ol li { | |
float:left; | |
width:95%; | |
padding-left:5px; | |
border-left:5px solid; | |
margin-bottom:4px; | |
} | |
#behat .scenario > ol li .argument, | |
#behat .scenario .examples > ol li .argument { | |
margin:10px 20px; | |
font-size:16px; | |
overflow:hidden; | |
} | |
#behat .scenario > ol li table.argument, | |
#behat .scenario .examples > ol li table.argument { | |
border:1px solid #d2d2d2; | |
} | |
#behat .scenario > ol li table.argument thead td, | |
#behat .scenario .examples > ol li table.argument thead td { | |
font-weight: bold; | |
} | |
#behat .scenario > ol li table.argument td, | |
#behat .scenario .examples > ol li table.argument td { | |
padding:5px 10px; | |
background:#f3f3f3; | |
} | |
#behat .scenario > ol li .keyword, | |
#behat .scenario .examples > ol li .keyword { | |
font-weight:bold; | |
} | |
#behat .scenario > ol li .path, | |
#behat .scenario .examples > ol li .path { | |
float:right; | |
} | |
#behat .scenario .examples { | |
margin-top:20px; | |
margin-left:40px; | |
} | |
#behat .scenario .examples h4 span { | |
font-weight:normal; | |
background:#f3f3f3; | |
color:#999; | |
padding:0 5px; | |
margin-left:10px; | |
} | |
#behat .scenario .examples table { | |
margin-left:20px; | |
} | |
#behat .scenario .examples table thead td { | |
font-weight:bold; | |
text-align:center; | |
} | |
#behat .scenario .examples table td { | |
padding:2px 10px; | |
font-size:16px; | |
} | |
#behat .scenario .examples table .failed.exception td { | |
border-left:5px solid #000; | |
border-color:#C20000 !important; | |
padding-left:0px; | |
} | |
pre { | |
font-family:monospace; | |
} | |
.snippet { | |
font-size:14px; | |
color:#000; | |
margin-left:20px; | |
} | |
.backtrace { | |
font-size:12px; | |
line-height:18px; | |
color:#000; | |
overflow:hidden; | |
margin-left:20px; | |
padding:15px; | |
border-left:2px solid #C20000; | |
background: #fff; | |
margin-right:15px; | |
} | |
#behat .passed { | |
background:#DBFFB4; | |
border-color:#65C400 !important; | |
color:#3D7700; | |
} | |
#behat .failed { | |
background:#FFFBD3; | |
border-color:#C20000 !important; | |
color:#C20000; | |
} | |
#behat .undefined, #behat .pending { | |
border-color:#FAF834 !important; | |
background:#FCFB98; | |
color:#000; | |
} | |
#behat .skipped { | |
background:lightCyan; | |
border-color:cyan !important; | |
color:#000; | |
} | |
#behat .summary { | |
position: absolute; | |
top: 0px; | |
left: 0px; | |
width:100%; | |
font-family: Arial, sans-serif; | |
font-size: 14px; | |
line-height: 18px; | |
} | |
#behat .summary .counters { | |
padding: 10px; | |
border-top: 0px; | |
border-bottom: 0px; | |
border-right: 0px; | |
border-left: 5px; | |
border-style: solid; | |
height: 52px; | |
overflow: hidden; | |
} | |
#behat .summary .switchers { | |
position: absolute; | |
right: 15px; | |
top: 25px; | |
} | |
#behat .summary .switcher { | |
text-decoration: underline; | |
cursor: pointer; | |
} | |
#behat .summary .switchers a { | |
margin-left: 10px; | |
color: #000; | |
} | |
#behat .summary .switchers a:hover { | |
text-decoration:none; | |
} | |
#behat .summary p { | |
margin:0px; | |
} | |
#behat .jq-toggle > .scenario, | |
#behat .jq-toggle > ol, | |
#behat .jq-toggle > .examples { | |
display:none; | |
} | |
#behat .jq-toggle-opened > .scenario, | |
#behat .jq-toggle-opened > ol, | |
#behat .jq-toggle-opened > .examples { | |
display:block; | |
} | |
#behat .jq-toggle > h2, | |
#behat .jq-toggle > h3 { | |
cursor:pointer; | |
} | |
#behat .jq-toggle > h2:after, | |
#behat .jq-toggle > h3:after { | |
content:' |+'; | |
font-weight:bold; | |
} | |
#behat .jq-toggle-opened > h2:after, | |
#behat .jq-toggle-opened > h3:after { | |
content:' |-'; | |
font-weight:bold; | |
} | |
</style> | |
<style type="text/css" media="print"> | |
body { | |
padding:0px; | |
} | |
#behat { | |
font-size:11px; | |
} | |
#behat .jq-toggle > .scenario, | |
#behat .jq-toggle > .scenario .examples, | |
#behat .jq-toggle > ol { | |
display:block; | |
} | |
#behat .summary { | |
position:relative; | |
} | |
#behat .summary .counters { | |
border:none; | |
} | |
#behat .summary .switchers { | |
display:none; | |
} | |
#behat .step .path { | |
display:none; | |
} | |
#behat .jq-toggle > h2:after, | |
#behat .jq-toggle > h3:after { | |
content:''; | |
font-weight:bold; | |
} | |
#behat .jq-toggle-opened > h2:after, | |
#behat .jq-toggle-opened > h3:after { | |
content:''; | |
font-weight:bold; | |
} | |
#behat .scenario > ol li, | |
#behat .scenario .examples > ol li { | |
border-left:none; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="behat"> | |
<div class="feature"> | |
<h2> | |
<span class="keyword">Feature: </span> | |
<span class="title">World consistency</span> | |
</h2> | |
<p> | |
In order to maintain stable behaviors<br /> | |
As a features developer<br /> | |
I want, that "World" flushes between scenarios<br /> | |
</p> | |
<div class="scenario"> | |
<h3> | |
<span class="keyword">Scenario: </span> | |
<span class="title">Nothing</span> | |
<span class="path">features\World.feature:6</span> | |
</h3> | |
<ol> | |
<li class="passed"> | |
<div class="step"> | |
<span class="keyword">Given </span> | |
<span class="text">I have entered <strong class="passed_param">10</strong></span> | |
<span class="path"><a href="http://localhost/features\steps\math.php">features\steps\math.php:2</a></span> | |
</div> | |
</li> | |
</ol> | |
</div> | |
</div> | |
<div class="summary passed"> | |
<div class="counters"> | |
<p class="scenarios"> | |
1 scenario (<strong class="passed">1 passed</strong>) | |
</p> | |
<p class="steps"> | |
1 step (<strong class="passed">1 passed</strong>) | |
</p> | |
</div> | |
<div class="switchers"> | |
<a href="javascript:void(0)" id="behat_show_all">[+] all</a> | |
<a href="javascript:void(0)" id="behat_hide_all">[-] all</a> | |
</div> | |
</div> | |
</div> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#behat .feature h2').click(function(){ | |
$(this).parent().toggleClass('jq-toggle-opened'); | |
}).parent().addClass('jq-toggle'); | |
$('#behat .scenario h3').click(function(){ | |
$(this).parent().toggleClass('jq-toggle-opened'); | |
}).parent().addClass('jq-toggle'); | |
$('#behat_show_all').click(function(){ | |
$('#behat .feature').addClass('jq-toggle-opened'); | |
$('#behat .scenario').addClass('jq-toggle-opened'); | |
}); | |
$('#behat_hide_all').click(function(){ | |
$('#behat .feature').removeClass('jq-toggle-opened'); | |
$('#behat .scenario').removeClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .scenarios .passed') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:not(:has(.failed, .pending))'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .steps .passed') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.passed)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .failed') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.failed)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .skipped') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.skipped)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
$('#behat .summary .counters .pending') | |
.addClass('switcher') | |
.click(function(){ | |
var $scenario = $('.feature .scenario:has(.pending)'); | |
var $feature = $scenario.parent(); | |
$('#behat_hide_all').click(); | |
$scenario.addClass('jq-toggle-opened'); | |
$feature.addClass('jq-toggle-opened'); | |
}); | |
}); | |
</script> | |
</body> | |
</html>' contains "<div class="scenario"> | |
<h3> | |
<span class="keyword">Scenario: </span> | |
<span class="title">Nothing</span> | |
<span class="path">features\World.feature:6</span> | |
</h3> | |
<ol> | |
<li class="passed"> | |
<div class="step"> | |
<span class="keyword">Given </span> | |
<span class="text">I have entered <strong class="passed_param">10</strong></span> | |
<span class="path"><a href="http://localhost/features/steps/math.php">features/steps/math.php:2</a></span> | |
</div> | |
</li> | |
</ol> | |
</div>". | |
In step `Then the output should contain:'. # FeatureContext::theOutputShouldContain() | |
From scenario `Links to step definitions relative to a remote base'. # features\closures\html.feature:402 | |
14. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
-$steps->Given('/^Что-то новое$/', function($world) { | |
+$steps->Given('/^Что-то но�(\d+)ое$/', function($world, $arg1) { | |
throw new \Behat\Behat\Exception\PendingException(); | |
});' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Pretty'. # features\closures\i18n.feature:128 | |
15. Failed asserting that two strings are equal. | |
--- Expected | |
+++ Actual | |
@@ @@ | |
-$steps->Given('/^Что-то новое$/', function($world) { | |
+$steps->Given('/^Что-то но�(\d+)ое$/', function($world, $arg1) { | |
throw new \Behat\Behat\Exception\PendingException(); | |
});' | |
In step `Then it should fail with:'. # FeatureContext::itShouldPassWith() | |
From scenario `Progress'. # features\closures\i18n.feature:179 | |
135 scenarios (120 passed, 15 failed) | |
809 steps (793 passed, 1 skipped, 15 failed) | |
1m16.83s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you perhaps post a shorter example to reproduce the issue?