Robot Framework Assistant - is a plugin for Sublime Text 2 / Sublime Text3 that provides some conveniences for working with Robot Framework test files (.txt and .robot).
Version 1.2.0 is not backward compatible. Please reinstall plugin and clean up old settings.
This plugin conflicts with sublime-robot-plugin.
Optionally, can work with http://rfdocs.org/.
The easiest way to install is to use Package Control and search for Robot Framework Assistant
.
Otherwise, open Sublime Text and click Preferences -> Browse Packages
to open the packages directory. Then create a directory named Robot Framework Assistant containing the contents of this repository.
To get the contents of this repository:
git clone git://github.com/andriyko/sublime-robot-framework-assistant.git
Download the plugin as a zip. Copy the content of the downloaded archive into Robot Framework Assistant directory (see previous section).
Note: term item means either Python Library, Resource File, Keyword (from Python Library or Resource File) or Variable.
- Syntax highlighting/automatic detection/activation for Robot Framework '.txt' and '.robot' files;
Alt+Enter
orAlt+Click
to go to source of item at caret (either Library, Resource, Keyword or Variable);Ctrl+Alt+Enter
orCtrl+Alt+Click
on item to log Keyword documentation or value of Variable into output panel.Ctrl+Space
to auto complete library/resource name, keywords (can start with any part/word of keyword). Using of '.' after library/resource name is also supported (limits keywords to given library/resource);- Autocomplete gives Keyword with its arguments formatted according to Robot Framework syntax. Jump through arguments with
TAB
key. $
or@
for autocomplete of Built-in and Resource variables (NOTE: as for now reading of Variables files is not supported);:
and thenTAB
to get list of special Robot Framework syntax elements (like [Arguments], [Return] etc);:f
and thenTAB
to insert :FOR loop template;*k
,*s
,*v
and thenTAB
to insert tables hedings templates (*** Keywords ***, *** Settings ***, *** Variables ***)- Toggle comments with
Cmd+/
; Cmd+B
to run pybot with current file;- Separate
Robot Framework
menu in Sublime Text main menu. Robot Framework
context menu which allows to run pybot with current file, scan libraries/resources, insert snippets etc.
Depending on your OS, you may have another key binding for autocomplete. For example in order to have autocomplete bound to Ctrl+Space
on Linux, add these lines to User key bindings (Preferences > Key Bindings - User
):
[
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
}
]
(Robot Framework > Settings
or use command palette).
You have to define python_interpreter
option manually. Should point to Python installation with Robot Framework packages.. An example of settings:
{
"log_level": "error",
"python_interpreter": "/Users/username/.virtualenvs/robotframework/bin/python",
"rfdocs_update_url": "http://rfdocs.org/dataset/download?",
"show_version_in_autocomplete_box": true
}
Ensure that python_interpreter
option is correct:
$ /Users/username/.virtualenvs/robotframework/bin/python
>>> import robot
>>> robot.__version__
'2.8.3'
(Robot Framework > Scanners
or use command palette)
Basically you will need to define only path
option for resource_scanners
setting. Set is_active
to false if you need to disable parser.
paths
(optional) - defines list of paths to append with sys.path.append.
pylib_scanners
- defines what parser
to use for libraries
from package
.
First dictionary from example is equivalent to:
>>> from robot.libraries import BuiltIn, OperatingSystem, Collections, Telnet, XML, Dialogs, String, Process, Screenshot, Remote
Second is equivalent to:
>>> import SeleniumLibrary, SSHLibrary, Selenium2Library
resource_scanners
- set path
option that points to your Robot Framework resources directory.
testcase_scanner
- defines parser to use for currently opened '.txt' or '.robot' file.
An example of scanners.json file:
{
"paths":
[
],
"pylib_scanners": [
{
"parser": "scanners.standard.PythonLibsScannerStandard",
"libraries": ["BuiltIn", "OperatingSystem", "Collections",
"Telnet", "XML", "Dialogs",
"String", "Process", "Screenshot", "Remote"],
"is_active": true,
"package": "robot.libraries"
},
{
"parser": "user_scanners.external.PythonLibsScannerExternal",
"libraries": ["SeleniumLibrary", "SSHLibrary", "Selenium2Library"],
"is_active": false,
"package": ""
}
],
"resource_scanners": [
{
"parser": "scanners.standard.ResourceFilesScannerStandard",
"path": "/path/to/resources/directory/or/file",
"is_active": false
}
],
"testcase_scanner":
{
"parser": "scanners.standard.TestCaseFilesScannerStandard",
"is_active": true
}
}
You can configure scanning of your own libraries in the same way as shown above. Or prepare customized scanner and put it under user scanners
module.
After changes made - either rescan and reindex data files or restart Sublime Text.
There are several ways to execute certain command:
- command palette (
Tools > Command Palette
menu item or use keys bindingCtrl+Shift+P
, type Robot Framework Assistant); Robot Framework
main menu;Robot Framework
menu item from context menu (right mouse click).
Edit main settings.
Edit scanners file.
Set Robot Framework syntax highlighting (works for .txt and .robot files).
Scan Python libraries, Resource files and current test file.
In order to have User Keywords and Variables data from current file, first scan current file (Robot Framework > Scan > Current file
or Ctrl+Alt+S
) and then Save File
.
(Re)index all files under robot_data
directory. Indexing of files is done automatically on plugin load (if current view is Robot Framework test file). Invoke this command manually if you need to update data for features like autocomplete.
Download file that contains list of packages (libraries) from rfdocs_update_url
URL.
Download packages (libraries) according to downloaded manifest file.
Shows manifest file that is currently used when downloading packages(libraries).
Opens directory that contains files (.json) downloaded from rfdocs.org.
Compares data from manifest file to actual downloaded and extracted data (ensures that zip files were unpacked without errors).