RobotKernel is a Robot Framework IPython kernel for Jupyter Notebook and JupyterLab. It powers RobotLab – the Robot Framework JupyterLab distribution.

RobotKernel requires Python 3.6 or later and Robot Framework 3.1 or later.

For alternative Robot Framework IPython kernel, check out ipythonrobotframework.

Try RobotKernel

You can try RobotKernel instantly without installing it at MyBinder cloud:

Note: Log | Report -links on saved notebooks may not be clickable until notebook is “trusted” (“Trust Notebook” in JupyterLab Commands) the related cells have been executed again.

Install RobotKernel

The easiest way to install RobotKernel is RobotLab, the Robot Framework JupyterLab distribution, but it can also be installed manually.

Export to .robot

It is possible to export Robot Framework Jupyter notebooks to regular plain text .robot files for usage without Jupyter tools:

From JupyterLab, export a notebook into .robot file by choosing from the menu

  1. File

  2. Export Notebook As…

  3. Export Notebook to Executable Script.

From Jupyter Notebook, export a notebook into .robot file by choosing from the menu

  1. File

  2. Download as

  3. Robot Framework (.robot).

From command-line with nbconvert:

$ jupyter nbconvert --to script example.ipynb

Robot Framework is also supported by Jupytext, which support exporting .robot from a notebook and keep them synchronized with as long as JupyterLab or Jupyter Notebooks is running on the background. This allows editing the notebook alternatively with Jupyter tools or the IDE of choice.

Note: Exporting notebooks with inline python modules defined using %%python module magics may result in broken .robot files requiring manual clean up of the exported inline python code.

Execute notebooks

RobotKernel installs a script named nbrobot. It can be used instead of Robot Framework’s robot test runner to execute Robot Framework with .ipynb-extension support:

$ nbrobot example.ipynb

In addition, it is also possible to execute notebooks with nbconvert to result a new notebook with embedded execution logs and reports:

$ jupyter nbconvert --to notebook --execute example.ipynb

On execution error, the partially executed notebook may not be saved until an extra argument --ExecutePreprocessor.allow_errors=True is given:

$ jupyter nbconvert --ExecutePreprocessor.allow_errors=True --to notebook --execute example.ipynb

This may change in future versions of nbconvert.

Note: When executing a notebook with nbconvert, each cell with tests cases or tasks will be executed as its own suite. This may cause differences in execution when compared to executing exported .robot files with robot or nbrobot.