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

feat: add a reporter for Tavern testing framework #312

Merged
merged 4 commits into from
Dec 5, 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 .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- "qase-robotframework"
- "qase-python-commons"
- "qase-behave"
- "qase-tavern"
name: Project ${{ matrix.changed-dir }} - Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -60,7 +61,8 @@ jobs:
"qase-pytest",
"qase-robotframework",
"qase-python-commons",
"qase-behave"
"qase-behave",
"qase-tavern"
]
if: startsWith(github.event.ref, 'refs/tags')
steps:
Expand Down
33 changes: 33 additions & 0 deletions examples/tavern/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/tavern
```

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
pytest
```
30 changes: 30 additions & 0 deletions examples/tavern/qase.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"mode": "testops",
"fallback": "off",
"debug": true,
"report": {
"driver": "local",
"connection": {
"local": {
"path": "./build/qase-report",
"format": "json"
}
}
},
"testops": {
"api": {
"token": "<token>",
"host": "qase.io"
},
"run": {
"title": "Tavern run",
"description": "Tavern examples",
"complete": true
},
"defect": false,
"project": "<project_code>",
"batch": {
"size": 200
}
}
}
2 changes: 2 additions & 0 deletions examples/tavern/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tavern==2.11.0
qase-tavern~=1.0.0
80 changes: 80 additions & 0 deletions examples/tavern/test_simple.tavern.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
test_name: Simple test success

stages:
- name: Step 1
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 2
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 3
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"


---
test_name: Simple test failed

stages:
- name: Step 1
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 2
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 300
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 3
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
80 changes: 80 additions & 0 deletions examples/tavern/test_with_id.tavern.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
test_name: QaseID=1 Test with QaseID success

stages:
- name: Step 1
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 2
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 3
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"


---
test_name: QaseID=2 Test with QaseID failed

stages:
- name: Step 1
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 2
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 300
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"

- name: Step 3
request:
url: https://jsonplaceholder.typicode.com/posts/1
method: GET
response:
status_code: 200
json:
id: 1
userId: 1
title: "sunt aut facere repellat provident occaecati excepturi optio reprehenderit"
body: "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
2 changes: 1 addition & 1 deletion qase-behave/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = [

[project.urls]
Homepage = "https://qase.io"
Repository = "https://github.com/qase-tms/qase-python/tree/master/qase-pytest"
Repository = "https://github.com/qase-tms/qase-python/tree/master/qase-behave"
Documentation = "https://developers.qase.io"


Expand Down
Loading
Loading