2014-10-17 23 views
0

我請求發送到與小提琴手服務器,它發送性反應Codeception - API試驗性反應的錯誤

Fiddler url: http://api.demo.loc/lc/ 
header:User-Agent: Fiddler 
Host: api.demo.loc 
Content-Type: application/x-www-form-urlencoded 
Content-Length: 49 
Request body: m=stt&l=2&n=5&news_version=2 

我想codeception檢查此

I wrote config like this: 
    class_name: ApiGuy 
    modules: 
      enabled: [PhpBrowser, REST, ApiHelper] 
      config: 
       PhpBrowser: 
         url: http://api.demo.loc/lc/ 
       REST: 
         url: http://api.demo.loc/lc/ 
And my code: 
    <?php 
    $I = new ApiGuy($scenario); 
    $I->wantTo('STEP 1'); 
    $I->haveHttpHeader('User-Agent: Codeception', 'Host: api.demo.loc'); 
    $I->haveHttpHeader('Content-Type: application/x-www-form-urlencoded','Content-Length: 49'); 

    // get a succesful response 
    $I->sendPOST('', array('m' => 'stt','l' => '2', 'n' => '5', 'news_version' => '2')); 
    $I->seeResponseCodeIs(200); 
    $I->seeResponseIsJson(); 
    $I->seeResponseContainsJson(array('result' => 'success')); 
    ?> 

線seeResponseContainsJson錯誤

回答

0

如果什麼你用--debug像這樣運行它?它是否提供了什麼錯誤的細節?

codecept.phar run --debug 
+0

也可以在命令末尾加上'--steps'並查看測試過程中的每一步。 – 2017-02-21 14:11:45