RF-Test-Agent:
Enables user to execute Robot Framework's (RF) test cases from VS Code editor window.
How to use?
Execute Enter run environment using command palette or shortcut keys Ctrl + R + E
. This needs to be performed only once after opening the editor. This step is optional but provides additional benefits if performed.
Now select test cases you want to execute in editor and execute Run selected test using command palette or shortcut keys Ctrl + R + T
.
Or
Select the suite you want to execute (open the <suite>.robot
file in editor) and Run selected suite using command palette or shortcut keys Ctrl + R + S
.
If shortcuts are not working click here to see how to fix it.
Features
Enter run environment
Following are the benefits of using Enter run environment:
- Creates organized report folder of test executions.
- Performs dryrun before each execution and sets total count variable ${TESTCOUNT} which is the number of all test cases under execution
(even if test cases are in different robot files).
Use this variable to log execution progress in console.
- In case of dry run, report with grey background is generated, helps
to distinguish between dry run and normal report.
- Allows user to re-run failed test cases from the given output file and merges
the results. Pass --rerunfailed
<output.xml path>
<suite>
in argument.
- Automatically opens report in browser after execution.
- Arguments passed by user is given highest prority, thus overrides
arguments used in this utility.
- User can also run other commands eg. git commands, ipconfig, pip commands, from same terminal session.
You need to perform steps only once
Steps:
- Open the RF suite in editor.
- Press
Ctrl + Shift + P
- Run command
RF-Test-Agent: Enter run environment
Note: Ctrl + C
terminates the execution and exits run environment.
Run selected test
Runs the selected RF test case(s) in VS Code's terminal.
Steps:
- Select single or multiple RF test case(s) in .robot file to execute.
- Press
Ctrl + Shift + P
- Run command
RF-Test-Agent: Run selected test
Run selected suite
Runs selected RF suite in VS Code's terminal.
Steps:
- Open the RF suite in editor.
- Press
Ctrl + Shift + P
- Run command
RF-Test-Agent: Run selected suite
Requirements
Python >= 3.0 should be installed.
Robot Framework >= 4.0 should be installed.
For "Enter run environment" command powershell should be present in your system.
Extension Settings
Send additional command line arguments:
If you want to send additional command line arguments like variables or report title,
you may add values in settings.json
of workspace in following manner:
If your workspace doesn't contain settings.json create a .vscode folder then create
settings.json inside it. Add below json object with your arguments in it.
{
"rf-agent.args":[
"-v variable1:string1",
"-v variable2:\"string with space\"",
"--reporttitle \"Title which you want in report\""
]
}
Note: Arguments provided will be concatenated with space, so no need to provide additional space
between the args.
If shortcut keys are not working for some reason below are the steps to add them manually.
Steps:
- Press
Ctrl + Shift + P
- Click settings button
RF-Test-Agent: Run selected test
command
- Add your desired key bindings, recommended is
Ctrl + R + T
- Similarly add desired key bindings for
RF-Test-Agent: Run selected suite
command,
recommended is Ctrl + R + S
- And add desired key bindings for
RF-Test-Agent: Run selected suite
command,
recommended is Ctrl + R + E
Or
Merge this in keybindings.json file present under "%USERPROFILE%\AppData\Roaming\Code\User" :
[
{
"key": "ctrl+r ctrl+t",
"command": "rf-agent.run-test"
},
{
"key": "ctrl+r ctrl+s",
"command": "rf-agent.run-suite"
},
{
"key": "ctrl+r ctrl+e",
"command": "rf-agent.run-env"
}
]
Created By
The extension has been developed by Deepesh Som