ページを選択

BDD

テスト ケースから BDD シナリオをエクスポートまたはインポートするには、次の API メソッドを使用します。

get_bdd

テスト ケースから BDD シナリオを .feature ファイルとしてエクスポートします。

GET index.php?/api/v2/get_bdd/{case_id}

パラメーター

名前 タイプ 必須 説明
case_id integer true テスト ケースの ID

リクエストの例

# Export the BDD scenario with a case ID of 2133
GET index.php?/api/v2/get_bdd/2133

レスポンスの内容

@APP-1
Feature: Users cannot login with invalid credentials
The login page should not allow users to login with invalid credentials, and it should not reveal sensitive info relating to the correctness of credentials.Background:Given I am viewing the login page

Scenario Outline: User cannot login with invalid username
Given I have entered into the username field
And I have entered into the password field
When I click the login button
Then I see I am not logged in
Examples:
|username|password|
|invalid1|validP@55w0rd!|
|invalid2@com|validP@55w0rd!|


Scenario: User cannot login with invalid password
Given I have entered "myname@valid.com" into the username field
And I have entered "invalid" into the password field
When I click the login button
Then I see I am not logged in


Rule: Login responses should not reveal sensitive information
Examples: Login response should not flag invalid username
Given I have entered an invalid username into the username field
And I have entered a valid password into the password field
When I click the login button
Then I see an error message
And the error message does not state that the username was incorrect
Examples: Login response should not flag invalid password
Given I have entered an invalid password into the password field
And I have entered a valid username into the username field
When I click the login button
Then I see an error message
And the error message does not state that the password was incorrect

レスポンス コード

ステータス コード 説明
200 OK
400 無効または不明なテスト ケース
500 エラーが発生しました

add_bdd

テスト ケースから BDD シナリオを .feature ファイルとしてインポート/アップロードします。

POST index.php?/api/v2/add_bdd/{section_id}

パラメーター

名前 タイプ 必須 説明
section_id integer true セクションの ID

リクエストの例

# Import the BDD scenario with a section ID of 188
POST index.php?/api/v2/add_bdd/188

レスポンスの内容

{
 "id": 2136,
 "title": "Users cannot login with invalid credentials",
 "section_id": 188,
 "template_id": 4,
 "type_id": 7,
 "priority_id": 2,
 "milestone_id": null,
 "refs": "APP-1",
 "created_by": 1,
 "created_on": 1653052591,
 "updated_by": 1,
 "updated_on": 1653052591,
 "estimate": null,
 "estimate_forecast": null,
 "suite_id": 12,
 "display_order": 3,
 "is_deleted": 0,
 "custom_automation_type": 0,
 "custom_preconds": "The login page should not allow users to login with invalid credentials, and it should not reveal sensitive info relating to the correctness of credentials.Background:Given I am viewing the login page\n\t",
 "custom_steps": null,
 "custom_testrail_bdd_scenario": "[{\"content\":\"\\tScenario Outline: User cannot login with invalid username\\n\\tGiven I have entered into the username field\\n\\tAnd I have entered into the password field\\n\\tWhen I click the login button\\n\\tThen I see I am not logged in\\n\\n\\tExamples:\\n\\t| username  | password    |\\n\\t| invalid1  | validP@55w0rd! |\\n\\t| invalid2@com | validP@55w0rd! |\"},{\"content\":\"\\tScenario: User cannot login with invalid password\\n\\tGiven I have entered \"myname@valid.com\" into the username field\\n\\tAnd I have entered \"invalid\" into the password field\\n\\tWhen I click the login button\\n\\tThen I see I am not logged in\"},{\"content\":\"\\tExample: Login response should not flag invalid username\\n\\tGiven I have entered an invalid username into the username field\\n\\tAnd I have entered a valid password into the password field\\n\\tWhen I click the login button\\n\\tThen I see an error message\\n\\tAnd the error message does not state that the username was incorrect\"},{\"content\":\"\\tExample: Login response should not flag invalid password\\n\\tGiven I have entered an invalid password into the password field\\n\\tAnd I have entered a valid username into the username field\\n\\tWhen I click the login button\\n\\tThen I see an error message\\n\\tAnd the error message does not state that the password was incorrect\"}]",
 "custom_expected": null,
 "custom_steps_separated": null,
 "custom_mission": null,
 "custom_goals": null
}

レスポンス コード

ステータス コード 説明
200 OK
400 無効または不明なセクション
403 権限が不十分です (プロジェクトにアクセスできません)
500 エラーが発生しました