通过此命令php codecept.phar run api LoginCest.php --steps
运行测试项目后,我得到以下输出:
* am trying to login.........
* I have http header "Content-Type","application/x-www-form-urlencoded"
* I send post "?",{"operation":"login","username":"xyz@abc.com","accessKey":"xyz"}
* I grab data from json response
* see test status:Passed.
但我只得到这个输出:
* am trying to login.........
* see test status:Passed.
这是我的代码:
$I->comment(" am trying to login.........");
$postData = array(
'operation' => 'login',
'username' => $username,
'accessKey' => $password
);
$url = "?";
$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST($url, $postData);
$outputData = $I->grabDataFromJsonResponse();
if ($outputData['success'] == true) {
$I->comment("see test status:Passed.");
} else {
$I->comment("see test status:Failed.");
}
只获取此方法输出:
$I->comment();
答案 0 :(得分:0)
使用选项-d
在调试模式下运行代码php codecept.phar run -d