PHP???????????????????
???????????? ???????[ 2016/6/3 14:14:13 ] ????????????????? ???????
???????Behat
?????????????ù?????????????????????Behat???????????ls_project??????????????
????$ ./vendor/behat/behat/bin/behat
?????????????????У??????????????
$ behat
????: ls
??????????????
??????UNIX???
?????????г????????????
????: ?г????е?2????? # features/ls.feature:7
???? ????"test"????
???? ???????"foo"???
?? ???????"bar"???
?? ??????"ls"??
??? ???????
"""
bar
foo
"""
1 scenario (1 undefined)
5 steps (5 undefined)
0m0.54s (9.96Mb)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Given ????:arg1????
*/
public function woZaiMuLuZhong($arg1)
{
throw new PendingException();
}
/**
* @Given ???????:arg1???
*/
public function zheGeMuLuYouWenJian($arg1)
{
throw new PendingException();
}
/**
* @When ??????:arg1??
*/
public function woYunXingHou($arg1)
{
throw new PendingException();
}
/**
* @Then ???????
*/
public function woNengKanDao(PyStringNode $string)
{
throw new PendingException();
}
?????????趨??
????Behat??????????features/ls.feature?????????????????????????С???????????и???Behat??“????????”test”????”??????????????????????????????????Behat?????????????????е????仰?????????????????????????“????”??????????Behat????????????????????????????????????????????????壺
/**
* @Given ????:arg1????
*/
public function woZaiMuLuZhong($arg1)
{
throw new PendingException();
}
?????Behat????????? features/bootstrap/FeatureContent.php?У????????$arg1?$dir??
<?php
use BehatBehatContextContext;
use BehatBehatContextSnippetAcceptingContext;
use BehatGherkinNodePyStringNode;
use BehatGherkinNodeTableNode;
/**
* Defines application features from the specific context.
*/
class FeatureContext implements Context?? SnippetAcceptingContext
{
/**
* @Given ????:dir????
*/
public function woZaiMuLuZhong($dir)
{
if (!file_exists($dir)) {
mkdir($dir);
}
chdir($dir);
}
}
???????????Behat???????????????????е?????磺”test”?????$dir????????????????????????????????????????С?
???????????????FeatureContent.php????μ?3?????裺
<?php
use BehatBehatContextContext;
use BehatBehatContextSnippetAcceptingContext;
use BehatGherkinNodePyStringNode;
use BehatGherkinNodeTableNode;
/**
* Defines application features from the specific context.
*/
class FeatureContext implements Context?? SnippetAcceptingContext
{
/**
* @Given ????:dir????
*/
public function woZaiMuLuZhong($dir)
{
if (!file_exists($dir)) {
mkdir($dir);
}
chdir($dir);
}
/**
* @Given ???????:file???
*/
public function zheGeMuLuYouWenJian($file)
{
touch($file);
}
/**
* @When ??????:command??
*/
public function woYunXingHou($command)
{
exec($command?? $output);
$this->output = trim(implode(" "?? $output));
}
/**
* @Then ???????
*/
public function woNengKanDao(PyStringNode $string)
{
if ((string) $string !== $this->output) {
throw new Exception(
"Actual output is: " . $this->output
);
}
}
}
????????????е???????——?????????????????????????????”””????????????????軀?????磺$string????????????????????(string)$string????$string->getRaw()???????????????????
?????????????????????????е???裬???????Behat??
$ ./vendor/behat/behat/bin/behat
????: ls
??????????????
??????UNIX???
?????????г????????????
????: ?г????е?2????? # features/ls.feature:7
???? ????"test"???? # FeatureContext::woZaiMuLuZhong()
???? ???????"foo"??? # FeatureContext::zheGeMuLuYouWenJian()
?? ???????"bar"??? # FeatureContext::zheGeMuLuYouWenJian()
?? ??????"ls"?? # FeatureContext::woYunXingHou()
??? ??????? # FeatureContext::woNengKanDao()
"""
bar
foo
"""
1 scenario (1 passed)
5 steps (5 passed)
0m0.56s (10.06Mb)
??????????Behat????????в???——?????μ?????????2????????????ls?????????????????????????
??????????????????????????????????衣
????Behat??????
???????????? behat —init??????????????????????
????.
?????????? features
?????????? bootstrap
?????????? FeatureContext.php
????2 directories?? 1 file
?????κκ?Behat?й?????????features??????????????????????
????features/ - Behat??????????е? *.feature???
????features/bootstrap - ????????????е?*.php?????????κβ???????????????
????features/bootstrap/FeatureContext.php - ??????????????????豻??е?????????
????features??????
??????????????????????????????????????????????????????Gherkin??????????????????????????Щ????????
???????*.feature??????????????“????”????ls??????????????????
?????????????ù????“????”???????????????????????????????壻
???????????????????????г??????????????????????????????????????
???????????????“????”??“?籾”???????????????????????????????
??????????????е???裬???????“????”??“??”??“???”??“????”??“????”??Щ?????????????Behat?????Щ????????????????????e?????????????μ??????
??????????“ Writing Features - Gherkin Language ”
????steps??????
??????????????У??????????Behat??“???”????????????????????????Behat??????????????????????????κο?????ж????????????PHPUnit????
???????????κ???????????????Behat?????“???”???
??????????“ Defining Reusable Actions - Step Definitions ”
????????????FeatureContent
????Behat?????????????????????????????????????????????е???????衣????????????????????蹲?????????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???PHP??SQL??????????????????PHP?????????????????JavaScript??Java??PHP????mysql php?????????PHP?????????????????PHP?????????????PHP+MYSQL???????????????Linux???汾php?????????????PHP???????????????????г???PHP???????PHPUnit?????????????????PHP-Phalcon????е?????????PHP?????????????Linux PHP5.3????PHP5.5.33PHP??java???????????????????PHP???????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????