Skip to content

Commit

Permalink
docs: add Robot Framework project with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gibiw committed Dec 3, 2024
1 parent a544821 commit 553d326
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Examples

This directory contains examples of how to use the `qase-pytest`.
This directory contains examples of how to use the Qase Python reporters.

- [pytest](./pytest/README.md) - Examples written in Pytest. Can be used with `pytest-xdist` library.
- [behave](./behave/README.md) - Examples written in Behave.
- [robot](./robot/README.md) - Examples written in Robot Framework. Can be used with `pabot` library.
33 changes: 33 additions & 0 deletions examples/robot/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# How to run these examples

1. Clone the repository

```bash
git clone https://github.com/qase-tms/qase-python.git
```

2. Move to the directory with the examples

```bash
cd qase-python/examples/robot
```

3. Install the required packages

```bash
pip install -r requirements.txt
```

4. Add the Qase token and project code to the ENV variables

```bash
export QASE_MODE=testops
export QASE_TESTOPS_API_TOKEN=your_token
export QASE_TESTOPS_PROJECT=your_project_code
```

5. Run the tests

```bash
robot --listener qase.robotframework.Listener .
```
28 changes: 28 additions & 0 deletions examples/robot/qase.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"mode": "testops",
"fallback": "off",
"debug": true,
"testops": {
"project": "<project_code>",
"api": {
"token": "<token>",
"host": "qase.io"
},
"run": {
"title": "robot framework examples"
},
"batch": {
"size": 200
}
},
"report": {
"driver": "local",
"connection": {
"local": {
"path": "./build/qase-report",
"format": "json"
}
}
},
"environment": "local"
}
2 changes: 2 additions & 0 deletions examples/robot/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
robotframework==7.1.1
qase-robotframework==3.2.2
25 changes: 25 additions & 0 deletions examples/robot/tests/parametrized.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
*** Settings ***
Library steps.py

*** Variables ***
${var1} 1
${var2} 1
${var3} 2

*** Test Cases ***
Parametrized Test success
[Tags] qase.params:[var1, var2]
Check numbers ${var1} ${var2} ${var3}
Passed Step

Parametrized Test failed
[Tags] qase.params:[var1, var2]
Check numbers ${var1} ${var2} ${var3}
Failed Step


*** Keywords ***
Check numbers
[Arguments] ${var1} ${var2} ${var3}
Should Be Equal As Numbers ${var1} ${var2}
Should Be Equal As Numbers ${var3} ${var3}
70 changes: 70 additions & 0 deletions examples/robot/tests/simple.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
*** Settings ***
Library steps.py

*** Test Cases ***

Test without metadata success
Step 01
Step 02
Passed step

Test without metadata failed
Step 01
Step 02
Failed Step


Test with QaseID success
[Tags] Q-10
Step 01
Step 02
Passed step


Test with QaseID failed
[Tags] Q-11
Step 01
Step 02
Failed Step


Ignored test success
[Tags] qase.ignore
Step 01
Step 02
Passed step


Ignored test failed
[Tags] qase.ignore
Step 01
Step 02
Failed Step


Test with fields success
[Tags] qase.fields:{ "preconditions": "Create object", "description": "It is simple test" }
Step 01
Step 02
Passed step


Test with fields failed
[Tags] qase.fields:{ "preconditions": "Create object", "description": "It is simple test" }
Step 01
Step 02
Failed Step


Test with all metadata success
[Tags] Q-12 qase.fields:{ "preconditions": "Create object", "description": "It is simple test" }
Step 01
Step 02
Passed step


Test with all metadata failed
[Tags] Q-13 qase.fields:{ "preconditions": "Create object", "description": "It is simple test" }
Step 01
Step 02
Failed Step
21 changes: 21 additions & 0 deletions examples/robot/tests/steps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from robot.api.deco import keyword


@keyword("Step 01")
def step01():
pass


@keyword("Step 02")
def step02():
pass


@keyword("Passed step")
def passed_step():
pass


@keyword("Failed step")
def failed_step():
assert False

0 comments on commit 553d326

Please sign in to comment.