A Jupyter kernel for interactive acceptance-test-driven development with the Robot Framework
Project description
Robotkernel
Robot Framework IPython kernel for Jupyter Notebook and JupyterLab.
Requires Python 3.6 or later.
Log | Report -links on existing notebooks are only active on trusted notebooks.
Try Robotkernel at Binder
Jupyter Notebook: https://mybinder.org/v2/gh/datakurre/robotkernel/master?urlpath=tree/example.ipynb
JupyterLab: https://mybinder.org/v2/gh/datakurre/robotkernel/master?urlpath=lab/tree/example.ipynb
Install Robotkernel
$ pip install robotkernel
$ python -m robotkernel.install
For JupyterLab you should also install the companion syntax highlighting:
$ jupyter labextension install jupyterlab_robotmode
Install Robotkernel from Python 3 notebook
!pip install robotkernel
!python -m robotkernel.install
After refreshing the notebook, it is possible change the kernel to Robot Framework kernel or create a new notebook with Robot Framework kernel.
For JupyterLab you should also install the companion syntax highlighting:
!jupyter labextension install jupyterlab_robotmode
Export robot files
It is possible to export test suites direclty from Jupyter Notebook or JupyterLab user interface (into traditional .robot files), but also from command line:
$ jupyter nbconvert --to script example.ipynb
Execute notebooks
In addition, it is also possible to execute notebooks as such, resulting into a new notebook with embedded execution logs and reports:
$ jupyter nbconvert --to notebook --execute example.ipynb
This will stop the execution at first failing test case.
When execution with errors, to also get a result notebook with execution logs saved, an extra flag --ExecutePreprocessor.allow_errors=True must be set:
$ jupyter nbconvert --ExecutePreprocessor.allow_errors=True --to notebook --execute example.ipynb
This may change in future versions of nbconvert.
Note that when executing a notebook, each cell with tests cases or tasks will be executed as its own suite. It might be more efficient to export notebook into a robot script and execute that with the traditional robot runner.
Local installation and development
See also: http://jupyter.readthedocs.io/en/latest/install.html
Create and activate clean Python virtual environment:
$ venv myenv $ source myenv/bin/activate
Install Jupyter:
$ pip install --upgrade pip setuptools $ pip install jupyter
Clone this kernel:
$ git clone https://github.com/datakurre/robotkernel.git $ cd robotkernel
Install the kernel into virtualenv in develop mode:
$ python setup.py develop
Install the kernel into jupyter:
$ python -m robotkernel.install
Launch the jupyter:
$ jupyter notebook
Reloading the kernel reloads the code.
Nix-shell (https://nixos.org/nix/)
This repository includes opinionated instructions for running and developing Robotkernel with Nix for Jupyter Notebook:
$ nix-shell -E 'import (fetchTarball https://github.com/datakurre/robotkernel/archive/master.tar.gz + "/shell.nix")' --run "jupyter notebook"
And for Jupyter Lab:
$ nix-shell -E 'import (fetchTarball https://github.com/datakurre/robotkernel/archive/master.tar.gz + "/shell.nix")'
$ jupyter labextension install jupyterlab_robotmode --app-dir=.jupyterlab
$ jupyter lab --app-dir=.jupyterlab
$ exit
Add --arg sikuli true to include SikuliLibrary.
Add --arg vim true to enable vim bindings.
Development environment with Nix:
$ git clone https://github.com/datakurre/robotkernel.git
$ cd robotkernel
$ nix-build setup.nix -A env # to generate ./result/bin/python for IDE
$ nix-shell setup.nix -A develop
Changelog
0.5.3 (2018-10-09)
Update README [datakurre]
0.5.1 (2018-10-08)
Auto completion and keyword doc inspection enhancements [datakurre]
0.5.0 (2018-10-08)
Add auto-completion, keyword doc inspection and support for replacing and deleting cell history on Jupyter lab [datakurre]
0.4.0 (2018-09-26)
Add support for robotframework 3.1a2 [datakurre]
Add support for reporting RPA suites with “Tasks” instead of “Tests” [datakurre]
0.3.5 (2018-09-25)
Update README with notebook execution instructions [datakurre]
0.3.4 (2018-09-25)
Update README [datakurre]
0.3.3 (2018-09-25)
Note on README that Log | Report -links require trusting the notebook [datakurre]
Fix to wrap test execution updates with ‘<pre>’ for better readability [datakurre]
0.3.2 (2018-09-25)
Change to always send display data updates in text/html to workaround a bug that caused ‘undefined’ to be rendered in JupyterLab [datakurre]
0.3.1 (2018-09-24)
Update README [datakurre]
0.3.0 (2018-09-23)
First release. [datakurre]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for robotkernel-0.5.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 218f877a3ac1db23b1b2c53951a8b440edc82ac8c66676132eb1eeb5e9b5d960 |
|
MD5 | 01c5c51a0eefc71986ed9a85d8958a54 |
|
BLAKE2b-256 | ee6132764275154beb66fdb246307b2f33ec5a309f10de461c9c1eea70057782 |