{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Running Robot" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook is associated with Robot Framework kernel. Therefore this notebook runs Robot Framework suites with tests or tasks." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Every Robot notebook cell must begin with** a one of the available Robot table headings: **Settings**, **Variables**, **Keywords**, **Test Cases** or **Tasks**." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "*** Settings ***\n", "\n", "Library String" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The same Robot table heading may be used in multiple code cells, and a single cell may contain Robot code for multiple tables." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "*** Settings ***\n", "\n", "Test teardown Log variables\n", "\n", "*** Variable ***\n", "\n", "${fullname} Jane Doe" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "While every cell must be executed in order, similarly to a Python notebook, resulting Robot Framework suite is executed only when the latest cell included either tests or tasks." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "*** Test Cases ***\n", "\n", "Name should contain exactly two words\n", " ${parts}= Split string ${fullname}\n", " Length should be ${parts} 2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "After executing a cell with tests or tasks, result links (`Log | Report`) are inserted below the executed cell. These links open the resulting Robot Framework log or report on a new browser tab, from which the log or report can also be downloaded as a file.\n", "\n", "All resulting logs and report are saved inline with the notebook file." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the case of a test failure, Robot Framework console output with error is displayed just below the log and report links. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "ename": "", "evalue": "", "output_type": "error", "traceback": [ "==============================================================================", "Jupyter ", "==============================================================================", "Name should contain exactly two three | FAIL |", "Length of '['Jane', 'Doe']' should be 3 but is 2.", "------------------------------------------------------------------------------", "Jupyter | FAIL |", "1 critical test, 0 passed, 1 failed", "1 test total, 0 passed, 1 failed", "==============================================================================", "Output: /run/user/1000/tmpcedcxu3q/output.xml" ] } ], "source": [ "*** Test Cases ***\n", "\n", "Name should contain exactly two three\n", " ${parts}= Split string ${fullname}\n", " Length should be ${parts} 3" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, if the last run keyword on a test or task returns a value (including possible test teardown), that value may be rendered below the cell." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/json": [ "Jane", "Doe" ], "text/html": [ "[\n",
" "Jane",\n",
" "Doe"\n",
"]\n",
""
]
},
"execution_count": 5,
"metadata": {
"expanded": true
},
"output_type": "execute_result"
}
],
"source": [
"*** Test Cases ***\n",
"\n",
"Name should still contain exactly two words\n",
" [Teardown] Set variable ${parts}\n",
" ${parts}= Split string ${fullname}\n",
" Length should be ${parts} 2"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Robot Framework",
"language": "robotframework",
"name": "robotkernel"
},
"language_info": {
"codemirror_mode": "robotframework",
"file_extension": ".robot",
"mimetype": "text/plain",
"name": "robotframework",
"pygments_lexer": "robotframework"
}
},
"nbformat": 4,
"nbformat_minor": 2
}