9 Feature: cats end-point Background: * url demoBaseUrl * configure logPrettyRequest = true * configure logPrettyResponse = true Scenario: create and retrieve a cat # create a new cat Given path 'cats’ And request { name: 'Billie' } When method post Then status 200 And match response == {id:'#number', name:'Billie'} * def id = response.id シナリオの開始 リクエストの定義(Given) +送信(When) レスポンスの確認(Then) →Assert処理
10 Feature: cats end-point Background: * url demoBaseUrl * configure logPrettyRequest = true * configure logPrettyResponse = true Scenario: create and retrieve a cat # create a new cat Given path 'cats’ And request { name: 'Billie' } When method post Then status 200 And match response == {id:'#number', name:'Billie'} * def id = response.id # get by id Given path 'cats’, id When method get Then status 200 And match response == {id:’#(id)', name:'Billie'} リクエストやレスポンスの内容を利用して、 連続したAPIの呼び出しができる
12 Scenario Outline: データ駆動テストーサンプルシナリオ Given path 'api/v1/circuits/<name>.json' When method get Then match $.MRData.CircuitTable.Circuits[0].Location.country == '<country>’ Examples: | name | country | | monza | Italy | | spa | Belgium | | sepang | Malaysia | テーブル形式で 複数データを指定 動的パラメータ