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 a console/ssh test, in TF Automate text pane:
- Type in the Scenario: keyword followed by the step title. Ex.:
Scenario: Establish an ssh connection and create a file.
Hit Enter. - Start the first step with a
Given shell session to "<Endpoint>"
to establish the ssh connection with the endpoint. The "<Endpoint>" parameter can also be in a JSON string format. Ex.:Scenario: Establish an ssh connection and create a file
Given shell session to
"""
{
"type": "ssh",
"host": "{{Hostname}}",
"port": 22,
"basicAuth":{
"username":"{{Username}}",
"password":"{{password}}"
}
}
"""Please note that in this example, the host, username and password values are referenced as variables from the Data Repository. In general, it is good practice to store these values as variables instead of hardcoding them in the test case text. Refer to this article for information on how to add variables to the data repository and this article for information on how to use them. - Write the rest of the step 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 run command <Command>
- Expected result:
- Then command should complete successfully
- Then command should fail
- Then command output should [not] contain <Text to look for>
- 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: Establish an ssh connection and create a file Given shell session to """ { "type": "ssh", "host": "{{Hostname}}", "port": 22, "basicAuth":{ "username":"{{Username}}", "password":"{{password}}" } } """ When I run command "touch my.file" Then command should complete successfully Scenario: Verify the file was created by running ls command When I run command "ls" Then command should complete successfully And command output should contain "my.file" |
Comments
0 comments
Please sign in to leave a comment.