Skip to content

WIP: Add live examples with Binder #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Examples/my_first.robot
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# +
*** Test Cases ***

My First Robot Test
Log To Console Hello Robot World!
Log To Console Hello Robot World!
# -
4 changes: 3 additions & 1 deletion Examples/my_second.robot
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# +
*** Settings ***
Library OperatingSystem

***Test Cases***

My Second Robot Test
Create File new_file.txt Hello World!
Create File new_file.txt Hello World!
# -
4 changes: 3 additions & 1 deletion Examples/my_third.robot
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# +
*** Settings ***
Library OperatingSystem

Expand All @@ -14,4 +15,5 @@ My Third Robot Test
My Forth Robot Test
${file_content} = Get File new_file.txt
Should Be Equal ${file_content} ${GOOD_TEXT}
Should Not Be Equal ${file_content} ${BAD_TEXT}
Should Not Be Equal ${file_content} ${BAD_TEXT}
# -
72 changes: 42 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,44 +48,56 @@ Following example shows how to write your first robot automation case:
1. Create a new file and save it using an extension `.robot`, for example, `my_first.robot`
2. Write in file `*** Test Cases ***`. This creates [section](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-data-sections) for test cases.
3. Type in following (note to add the four spaces before `Log To Console`)
```
My First Robot Test
Log To Console Hello Robot World!
```

```robotframework
My First Robot Test
Log To Console Hello Robot World!
```

4. First test is now ready and it should look like this:
```
*** Test Cases ***

My First Robot Test
Log To Console Hello Robot World!
```
```robotframework
*** Test Cases ***

My First Robot Test
Log To Console Hello Robot World!
```

<div data-notebook="Examples/my_first.robot"></div>

5. Open Terminal/Command Prompt. Navigate to the same folder where your `.robot` file is located and run the test by inputting command `robot my_first.robot`. For example:
```
cd your_folder
robot my_first.robot
```

```
cd your_folder
robot my_first.robot
```

6. When Robot is run, you will see this:
```
> robot my_first.robot
==============================================================================
My First
==============================================================================
My First Robot Test Hello Robot World!
My First Robot Test | PASS |
------------------------------------------------------------------------------
My First | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output: /output.xml
Log: /log.html
Report: /report.html

```

```
> robot my_first.robot
==============================================================================
My First
==============================================================================
My First Robot Test Hello Robot World!
My First Robot Test | PASS |
------------------------------------------------------------------------------
My First | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output: /output.xml
Log: /log.html
Report: /report.html

```
Robot has created test report files in the same folder where you run the test. You can check details of the first test run by opening report.html file.

[Examples](./Examples) of this manual introduces Keyword Libraries and Variables related to Robot Framework automation.

## More information

Thank you for visiting the Beginners Guide! Hope you enjoyed learning Robot Framework. More about writing test cases: [How To Write Good Test Cases](https://github.com/robotframework/HowToWriteGoodTestCases/blob/master/HowToWriteGoodTestCases.rst).

<script src="iframeResizer.min.js"></script>
<script src="notebook-support.js"></script>
31 changes: 31 additions & 0 deletions binder/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#header,
#menubar,
#maintoolbar {
display: none !important;
}
#notebook {
margin: none !important;
padding: 0 !important;
}
#notebook-container {
margin: 0 !important;
padding: 0 !important;
box-shadow: none !important;
width: auto !important;
}
#site {
height: auto !important;
}
body {
background: white !important;
bottom: auto !important;
padding-bottom: 1px;
}
.end_space {
display: none;
}
.input_prompt,
.prompt,
.prompt_container {
display: none !important;
}
12 changes: 12 additions & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: robotkernel
channels:
- conda-forge
dependencies:
- python >=3.6,<3.8.0a0
- jupyterlab >=1.2.4,<1.3
- nodejs >=11,<12
- pip
- pip:
- robotframework==3.1.2
- robotkernel==1.3.0
- jupytext==1.3.2
29 changes: 29 additions & 0 deletions binder/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
---
jupyter:
jupytext:
text_representation:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.3.2
kernelspec:
display_name: Robot Framework
language: robotframework
name: robotkernel
---

```robotframework
*** Settings ***

Library String

*** Variables ***

${MESSAGE} Hello World

*** Test Cases ***

Message is Hello World
Should be equal ${MESSAGE} Hello World
```
29 changes: 29 additions & 0 deletions binder/example.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .robot
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.3.2
# kernelspec:
# display_name: Robot Framework
# language: robotframework
# name: robotkernel
# ---

# +
*** Settings ***

Library String

*** Variables ***

${MESSAGE} Hello World

*** Test Cases ***

Message is Hello World
Should be equal ${MESSAGE} Hello World
# -
Loading