You can hit CTRL+SPACE to trigger the auto-completer anywhere in the sentence to help you with writing the test case. |
In order to automate an API/HTTP test case, in TF Editor text pane:
- Type in the Scenario: keyword followed by the step title. Ex.:
Scenario: Send a request to the API.
Hit Enter. - Start any step where you are going to send a request to the API with
Given <Method> HTTP request
where Method is one of: GET, POST, PUT, DELETE. Ex.:Given GET HTTP request
- Write the rest of the steps using TestFirst Gherkin specification. Below you can find the most common sentences you can use for the action and the expected result part of the step:
- Action:
- When I send request to <Target URL>
- When I set request body to JSON of
"""
<multi-line value>
""" - When I save response body to <Variable name> variable
- When I extract value from <Source variable name> variable with jsonpath <JSONPath selector> to <Target variable name> variable
- Expected result:
- Then request should complete successfully
- Then response status should be <HTTP status code>
- Then <Left value> should [not] be <operator> <Right value>
- Action:
- Run the test as described in this article and make sure it runs successfully.
- Save the test by clicking the Save icon above the text pane.
- Publish the test by clicking on the Publish icon (checkmark) above the text pane to change the automation status of the test case to Automated (read more on statuses here).
Within the same step indicated by the Scenario keyword, you can only use When and Then sentences once. Any further action or expected result should be started with the And keyword. Ex.: Scenario: Verify the forecast starts at day 1 |
Comments
0 comments
Please sign in to leave a comment.