-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
### Behave Example | ||
|
||
This is a sample project demonstrating how to write and execute tests using the Behave framework with integration to | ||
Qase Test Management. | ||
|
||
--- | ||
|
||
## Prerequisites | ||
|
||
Ensure that the following tools are installed on your machine: | ||
|
||
1. [Python](https://www.python.org/) (version 3.7 or higher is recommended) | ||
2. [pip](https://pip.pypa.io/en/stable/) | ||
|
||
--- | ||
|
||
## Setup Instructions | ||
|
||
1. Clone this repository by running the following commands: | ||
```bash | ||
git clone https://github.com/qase-tms/qase-python.git | ||
cd qase-python/examples/behave | ||
``` | ||
|
||
2. Install the project dependencies: | ||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
3. Create a `qase.config.json` file in the root of the project. Follow the instructions on | ||
[how to configure the file](https://github.com/qase-tms/qase-python/tree/main/qase-behave/docs/configuration). | ||
|
||
4. To run tests and upload the results to Qase Test Management, use the following command: | ||
```bash | ||
behave --format=qase.behave.formatter:QaseFormatter | ||
``` | ||
This will execute the tests and display the results in the terminal. | ||
|
||
--- | ||
|
||
## Additional Resources | ||
|
||
For more details on how to use this integration with Qase Test Management, visit | ||
the [Qase Behave documentation](https://github.com/qase-tms/qase-python/tree/main/qase-behave). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "Behave run", | ||
"description": "Behave examples", | ||
"complete": true | ||
}, | ||
"defect": false, | ||
"project": "<project_code>", | ||
"batch": { | ||
"size": 200 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
behave>=1.2.6 | ||
qase-behave>=1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Feature: Parametrized Tests | ||
|
||
Scenario Outline: Test with parameters success | ||
Given I have a test with parameters "<param1>" and "<param2>" | ||
When I run it | ||
Then it should pass | ||
|
||
Examples: | ||
| param1 | param2 | | ||
| 1 | 2 | | ||
| 3 | 4 | | ||
| 5 | 6 | | ||
|
||
|
||
Scenario Outline: Test with parameters failed | ||
Given I have a test with parameters "<param1>" and "<param2>" | ||
When I run it | ||
Then it should fail | ||
|
||
Examples: | ||
| param1 | param2 | | ||
| 1 | 2 | | ||
| 3 | 4 | | ||
| 5 | 6 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Feature: Simple tests | ||
|
||
Scenario: Test without annotations success | ||
Given I have a simple test | ||
When I run it | ||
Then it should pass | ||
|
||
Scenario: Test without annotations failed | ||
Given I have a simple test | ||
When I run it | ||
Then it should fail | ||
|
||
@qase.id:1 | ||
Scenario: Test with QaseID success | ||
Given I have a simple test | ||
When I run it | ||
Then it should pass | ||
|
||
@qase.id:2 | ||
Scenario: Test with QaseID failed | ||
Given I have a simple test | ||
When I run it | ||
Then it should fail | ||
|
||
@qase.fields:{"description":"It_is_simple_test"} | ||
Scenario: Test with Fields success | ||
Given I have a simple test | ||
When I run it | ||
Then it should pass | ||
|
||
@qase.fields:{"description":"It_is_simple_test"} | ||
Scenario: Test with Fields failed | ||
Given I have a simple test | ||
When I run it | ||
Then it should fail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from behave import * | ||
|
||
@given('I have a simple test') | ||
def step_impl(context): | ||
pass | ||
|
||
@given('I have a test with parameters "{param1}" and "{param2}"') | ||
def step_given_test_with_parameters(context, param1, param2): | ||
pass | ||
|
||
@when('I run it') | ||
def step_impl(context): | ||
pass | ||
|
||
|
||
@then('it should pass') | ||
def step_impl(context): | ||
pass | ||
|
||
|
||
@then('it should fail') | ||
def step_impl(context): | ||
assert False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Feature: Simple1 tests | ||
|
||
@qase.suite:MySuite | ||
Scenario: Test with single suite success | ||
Given I have a simple test | ||
When I run it | ||
Then it should pass | ||
|
||
@qase.suite:MySuite | ||
Scenario: Test with single suite failed | ||
Given I have a simple test | ||
When I run it | ||
Then it should fail | ||
|
||
@qase.suite:MySuite||SubSuite | ||
Scenario: Test with multiple suite success | ||
Given I have a simple test | ||
When I run it | ||
Then it should pass | ||
|
||
@qase.suite:MySuite||SubSuite | ||
Scenario: Test with multiple suite failed | ||
Given I have a simple test | ||
When I run it | ||
Then it should fail |