ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Robot Framework Assistant

by andriyko ST2/ST3

Robot Framework plugin for Sublime Text3

Details

  • 3 3.2.0
    2 1.3.0
  • github.​com
  • github.​com
  • 1 day ago
  • 1 hour ago
  • 2 years ago

Installs

  • Total 4K
  • Win 2K
  • OS X 1K
  • Linux 711
May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18
Windows 3 1 3 12 11 31 21 30 4 4 24 26 5 17 10 0 0 0 0 4 1 9 9 1 4 9 7 5 4 0 0 6 6 3 7 6 4 1 4 4 3 6 7 0 1 4
OS X 4 0 0 6 7 8 6 14 3 2 16 7 6 5 7 0 0 0 0 2 3 3 2 2 5 7 3 8 2 0 0 3 6 1 2 3 1 0 3 2 4 4 4 1 1 2
Linux 0 1 0 7 1 5 6 5 0 0 3 3 1 6 2 0 0 0 0 0 5 2 0 0 5 2 1 3 5 1 0 2 0 2 2 2 0 1 0 4 0 4 4 0 0 2

Readme

Source
raw.​githubusercontent.​com

Build Status

Robot Framework Assistant

Robot Framework Assistant provides IDE features to edit Robot Framework test data in the Sublime Text 3.

From release 3.0.0 onwards plugin is not anymore compatible with Sublime Text 2. The releases made before the 3.0.0 will serve the Sublime Text 2 users. The documentation for Sublime Text 2 user can be found from st2-maintenance branch README

Installation

The easiest way to install is to use Package Control and search for: Robot Framework Assistant.

Alternative installation methods

Download the plugin as a zip. Open Sublime Text and click *** | Preferences | Browse Packages | *** to open the packages directory. Then create a directory named Robot Framework Assistant and unzip the plugin to the directory.

Configuration

Before yo can start using the Robot Framework Assistant, you must at least configure the settings in the User package Robot.sublime-settings file. To Open the file navigate to: Preferences | Package settings | Robot Framework Assistant | Settings - User | The default settings can be found from the Preferences | Package settings | Robot Framework Assistant | Settings - Default |

robot_framework_workspace

Before the Robot Framework Assistant can provide the keyword and variable completion features, it needs to create a database from the test suite and resource files. The argument defines the root folder where scanning of robot data is performed.

Must point to a folder and pointing to a file is not allowed. When the command Robot Framework: Create database is executed, the scanning of Robot Framework test data is performed based on this setting.

In windows ow write double backslash to write literal backslash.

robot_framework_keyword_argument_format

Defines how keyword argument are formatted when keyword completion is used. When set to false, each argument is formatted to individual lines. If set to true keyword and arguments are returned in single line.

robot_framework_extension

File extension defines which types of files the Robot Framework Assistant plugin will search from the folder defined in the robot_framework_workspace option.

This setting affects the plugin commands and features but the theme definition in this plugin is not affected by this option.

If there library or variable file imports in the Robot Framework data, those imports are automatically parser and included in the scanning.

path_to_python

In order the creating the database of keywords and variables to work, path to Python binary must be defined. It must be the same Python binary where the Robot Framework is installed.

In Linux like environments this could be like: /usr/bin/python and in Windows this could be like: C:\Python27\python.exe

robot_framework_module_search_path

Module search path defines a list of paths where the Robot Framework libraries are searched. Example if you have imported a library with the library name, then module search path must contain the folder where the library can be located.

The Robot Framework Assistant uses the Robot Framework API to parse the test data and libraries. All changes, which are not system wide, to locate the libraries, must also be added in the module search path in the Robot Framework Assistant

More details how libraries is searched in Robot Framework can be found from be the Robot Framework User guide

robot_framework_library_in_xml

When a library is not available during parsing time, example if library is imported with Remote library interface or it is not written in Python like the SwingLibrary Then this setting can be used to import libraries in libdoc XML format.

Libraries found from the this path are globally available, like the BuiltIn library. Example the keyword completion will work although the library may not imported for that particular resource or test suite.

robot_framework_builtin_variables

Robot Framework comes by default some predefined and builtin variables. These variables names may change between different Robot Framework versions. Use this setting to define a list of the Robot Framework BuiltIn variables. The easiest way to see the list of the variables is to run Robot Framework with following test case:

*** Test Cases ***
Log All BuiltIn Vars
Log Variables

Note: At least on Robot Framework 2.9.2 version, the following command did not list the empty variables, like ${EMPTY}.

robot_framework_database_path

By default internal database is created in plugin installation directory, in database folder. Sometimes it could be useful to change the default database location.

Example if the robot_framework_workspace is defined in the Sublime workspace file and user wants to change between different projects. Then it is useful to define robot_framework_database_path setting also be project specific. When the internal database is project specific, user does not recreate the database when the project is changed.

The robot_framework_database_path must be a path to a folder. If the setting is not path to a folder, then the database is created in the plugin installation directory.

Syntax definitions

By default this plugin will be used with files which extension is .robot and plugin will use four spaces as cell separator. The settings can be changed by user, but consult the Sublime unofficial documentation where the user settings should be saved.

Change the file extension

The file extension is defined in the Robot.tmLanguage file. To change file extension, navigate to the User package folder and open the Robot.tmLanguage file.

Look for the lines containing:

<key>fileTypes</key>
    <array>
        <string>robot</string>
    </array>

The <string> element contains the file type definition.

Change the cell separator

The cell separator is defined in the Robot.tmPreferences file. To change the cell separator, navigate to the User package folder and open the Robot.tmPreferences file.

Look for the line containing <string><![CDATA[ ]]></string> XML tag. There are four spaces inside of the [ ] characters and those four spaces defines the cell separator which is user by the plugin. The cell separator is example used by the for loop snippets to align and display snipped correctly.

Hotkeys

  • Pressing Alt + Enter or Alt + Click with mouse, on top of the keyword will go to the keyword source. Source of the keyword can locate in Robot Framework test data or in a Python library. Go to does not work on libraries written in other programming languages.
  • Pressing Ctrl + Alt + Enteror Ctrl + Alt + Clicl with mouse will display the keyword documentation.
  • Pressing Ctrl + / or Ctrl + Shift + / will togle comment on and off
  • Pressing Ctrl + Alt + a will run the Robot Framework: Create Database command
  • Pressing Ctrl + Alt + s will run the Robot Framework: Create Database Tables command
  • Pressing Ctrl + Alt + t will run the Robot Framework: Create Database Table From Active Tab command
  • Pressing Ctrl + Alt + i will run the Robot Framework: Create Database Index From Active Tab command
  • Pressing Ctrl + Alt + r will show available library, resource or variables imports in a popup menu. The popup menu is only displayed if cursor is in settings table and line contains Libraries, Resource or Variables setting.

The usage of the Ctrl + Alt + a/s/t/i commands is explained in the Internal database for keywords and variables wiki page

Snippets

Snippets are a Sublime Text feature to provide commonly used text templates and in this plugin, snippets offers quick access to the commonly used settings in the Robot Framework data. To gain access to the snippets write the required character combination. If the snippet is not displayed press the Tab key to see the snippets completion list. The snippets can be accessed with following key combinations: * Write :f to access Robot Framework for loops. There currently are available the following snippets: normal, enumerate, range and zip loops types. * Write *k to access *** Keywords *** table snippet. * Write *s to acess *** Settings *** table and it settings. There currently are available the following snippets: Default Tags, Documentation, Library, Resource, *** Settings ***, Test Setup, Test Teardown, Test Template and Test Timeout. * Write *t to access *** Test Cases *** table snippet. * Write :to access Keyword and Test Case settings. There currently are available the following snippets:: [Arguments], [Documentation], [Return] [Tags], [Teardown] and [Timeout]. * Write *v to access *** Variables *** snippet.

The different for loop snippets uses the fields feature from the snippets. After completing the for loop snippry, the different for loops fields can be accessed by pressing the tab key.

Please note that plugin does not prevent the user to place snippets in invalid places in the test data. Please refer to the Robot Framework User Guide to locate the correct usage of the different available snippets.

Go To Keyword

Alternatively, use Sublime Text's Go To Symbol to go to the source of a Keyword.

Please note that Go To Symbol only works for keywords within the same file. It is not possible to use Go To Symbol to jump keyword in other resource files or in libraries.

Creating a database

Once the plugin configuration is done, the plugin needs to scan the test data to create a internal database to the package directory. The database will contain table for each test case, resource and library. Once the tables has been created, plugin will create a index for each test case, resource and library. Index will contain all keywords and variables, what the test case or resource has imported in the test data. Indexing allows plugin to provide completion to only those keyword or variables which has been imported for the currently opened test or resource file.

The plugin will automatically update the pointer to the index in the database, when user will change between different tabs in the Sublime.

More detailed description how to update the internal database can be found from the Internal database for keywords and variables wiki page.

Error investigation for database creation

When creating the database, plugin will write a log file to the package installation directory: database/scan_index.log file. If there are errors when the database is created, please check the log and correct possible errors.

Project specific settings

It is also possible to use project specific setting when configuring the Robot Framework Assistant.

Open the project setting and add robot_framework_assistant dictionary to the settings file:

"robot_framework_assistant":
    {

    }

Example if configuring project specific workspace and database paths, the robot_framework_assistant dictionary should look like this:

"robot_framework_assistant":
    {
        "robot_framework_workspace": "/path/to/folder/containing/robot/data",
        "robot_framework_database_path": "/path/to/project/database"
    }