Skip to content
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

docs: add Robot Framework project with examples #310

Merged
merged 3 commits into from
Dec 3, 2024
Merged
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/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"
}
3 changes: 3 additions & 0 deletions examples/robot/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
robotframework==7.1.1
qase-robotframework==3.2.2
robotframework-pabot==2.18.0
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
Loading