diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-behave-testrail-reporter.spec | 565 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 567 insertions, 0 deletions
@@ -0,0 +1 @@ +/behave-testrail-reporter-0.5.1.tar.gz diff --git a/python-behave-testrail-reporter.spec b/python-behave-testrail-reporter.spec new file mode 100644 index 0000000..083bf96 --- /dev/null +++ b/python-behave-testrail-reporter.spec @@ -0,0 +1,565 @@ +%global _empty_manifest_terminate_build 0 +Name: python-behave-testrail-reporter +Version: 0.5.1 +Release: 1 +Summary: Behave library to integrate with Testrail API +License: MIT +URL: https://github.com/virtualstock/behave-testrail-reporter/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e4/1d/5ecff596161601dda81a7d7057c48b9733e846eb48fce598e22e7bbe6398/behave-testrail-reporter-0.5.1.tar.gz +BuildArch: noarch + +Requires: python3-jsonschema +Requires: python3-behave +Requires: python3-pyyaml +Requires: python3-requests + +%description +# Behave to TestRail Reporter + + +[](https://circleci.com/gh/Virtualstock/behave-testrail-reporter) +[](https://www.codacy.com/app/Virtualstock/behave-testrail-reporter?utm_source=github.com&utm_medium=referral&utm_content=Virtualstock/behave-testrail-reporter&utm_campaign=Badge_Grade) +[](https://www.codacy.com/app/Virtualstock/behave-testrail-reporter?utm_source=github.com&utm_medium=referral&utm_content=Virtualstock/behave-testrail-reporter&utm_campaign=Badge_Coverage) +[](https://pullreminders.com?ref=badge) + +This integration is used to add test results to TestRail automatically when Behave tests are executed. + + +Example of the generated report: + +``` +3 testrail test cases passed, 0 failed, 19 skipped, 2 untested +Took 0m6.349s +``` + +## Install + +Can install it using pipenv + +``` +$ pipenv install behave-testrail-reporter +``` + +or using pip + +``` +$ pip install behave-testrail-reporter +``` + +## Setup + +Add `TestrailReporter` to behave reporters in your `/features/environment.py` by adding this code in `before_all()` + +```python +from behave_testrail_reporter import TestrailReporter + +def before_all(context): + # ... all your other awesome code in here + current_branch = os.environ.get('CIRCLE_BRANCH') # Change this to get the current build branch of your CI system + testrail_reporter = TestrailReporter(current_branch) + context.config.reporters.append(testrail_reporter) +``` + + +Create a `testrail.yml` config file in the root of your project + + +Example structure: + + +```yaml +base_url: https://your-domain.testrail.io +projects: + - name: 'Advanced tests on branch {branch}' + id: 123 + suite_id: 456 + # note: this will allow any branch to push test case results to Testrail. + allowed_branch_pattern: '.*' + - name: 'Smoke tests on branch {branch}' + id: 1234 + suite_id: 789 + # note: this will allow any branch to push test case results to Testrail. + allowed_branch_pattern: '.*' +``` + +Allow only **master** branch and **release1.111.1** to push test results to Testrail: +```yaml +base_url: https://your-domain.testrail.io +projects: + - name: 'Full E2E tests on branch {branch}' + id: 123 + suite_id: 456 + allowed_branch_pattern: '^(master|release\/\d+([\.\d]+)?)$' +``` + +| yaml key | Description | +| ---------------------- | ---------------------------------------------------------- | +| name | Project name | +| id | Testrail project id | +| suite_id | Testrail Suite id | +| allowed_branch_pattern | Regular expression to restrict when a test run is executed | + +**name** - You can use some project variables to create dynamic test run names + +| Variable | Example | Result | +| ------------ | ----------------------- | --------------- | +| {project_id} | 'Test run {project_id}' | Test run 123 | +| {suite_id} | 'Test run {suite_id}' | Test run 456 | +| {branch} | 'Test run {branch}' | Test run master | + + +**Environment variables required** + +| Variable name | Description | +| ------------------- | --------------------------- | +| TESTRAIL_KEY | TestRail user password | +| TESTRAIL_USER | TestRail user email address | + + + +## How to use + +To get test cases marked as success or fail on TestRail we have to add tags with TestRail test case ID +on each scenario. + +Test case tag structure: + +`prefix` + `test case id` + +`@testrail-` + `C1104` + +See example below: + +```gherkin +Feature: Log in and out + + Background: + Given I am logged out from Hub + And I navigate to the home page + + @testrail-C1104 + @testrail-C45933 + Scenario: Admin can login + When I enter the username admin + And I enter the password admin + And I click the Login button + Then I see the admin's landing page +``` + +Note: some scenarios can cover multiple TestRail cases, for that you just need to add multiple tags. + +## How to contribute + +### Install dependencies for development + +``` +pipenv install --dev +``` + +### How to run tests + +Activate your virtual environment and then just run tox. +``` +tox +``` + +## How to distribute + +If you need to publish a new version of this package you can use this command: + +``` +python setup.py sdist bdist_wheel +twine upload dist/* +``` + + +# License +Licensed under `MIT license`. View [license](LICENSE). + + + + +%package -n python3-behave-testrail-reporter +Summary: Behave library to integrate with Testrail API +Provides: python-behave-testrail-reporter +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-behave-testrail-reporter +# Behave to TestRail Reporter + + +[](https://circleci.com/gh/Virtualstock/behave-testrail-reporter) +[](https://www.codacy.com/app/Virtualstock/behave-testrail-reporter?utm_source=github.com&utm_medium=referral&utm_content=Virtualstock/behave-testrail-reporter&utm_campaign=Badge_Grade) +[](https://www.codacy.com/app/Virtualstock/behave-testrail-reporter?utm_source=github.com&utm_medium=referral&utm_content=Virtualstock/behave-testrail-reporter&utm_campaign=Badge_Coverage) +[](https://pullreminders.com?ref=badge) + +This integration is used to add test results to TestRail automatically when Behave tests are executed. + + +Example of the generated report: + +``` +3 testrail test cases passed, 0 failed, 19 skipped, 2 untested +Took 0m6.349s +``` + +## Install + +Can install it using pipenv + +``` +$ pipenv install behave-testrail-reporter +``` + +or using pip + +``` +$ pip install behave-testrail-reporter +``` + +## Setup + +Add `TestrailReporter` to behave reporters in your `/features/environment.py` by adding this code in `before_all()` + +```python +from behave_testrail_reporter import TestrailReporter + +def before_all(context): + # ... all your other awesome code in here + current_branch = os.environ.get('CIRCLE_BRANCH') # Change this to get the current build branch of your CI system + testrail_reporter = TestrailReporter(current_branch) + context.config.reporters.append(testrail_reporter) +``` + + +Create a `testrail.yml` config file in the root of your project + + +Example structure: + + +```yaml +base_url: https://your-domain.testrail.io +projects: + - name: 'Advanced tests on branch {branch}' + id: 123 + suite_id: 456 + # note: this will allow any branch to push test case results to Testrail. + allowed_branch_pattern: '.*' + - name: 'Smoke tests on branch {branch}' + id: 1234 + suite_id: 789 + # note: this will allow any branch to push test case results to Testrail. + allowed_branch_pattern: '.*' +``` + +Allow only **master** branch and **release1.111.1** to push test results to Testrail: +```yaml +base_url: https://your-domain.testrail.io +projects: + - name: 'Full E2E tests on branch {branch}' + id: 123 + suite_id: 456 + allowed_branch_pattern: '^(master|release\/\d+([\.\d]+)?)$' +``` + +| yaml key | Description | +| ---------------------- | ---------------------------------------------------------- | +| name | Project name | +| id | Testrail project id | +| suite_id | Testrail Suite id | +| allowed_branch_pattern | Regular expression to restrict when a test run is executed | + +**name** - You can use some project variables to create dynamic test run names + +| Variable | Example | Result | +| ------------ | ----------------------- | --------------- | +| {project_id} | 'Test run {project_id}' | Test run 123 | +| {suite_id} | 'Test run {suite_id}' | Test run 456 | +| {branch} | 'Test run {branch}' | Test run master | + + +**Environment variables required** + +| Variable name | Description | +| ------------------- | --------------------------- | +| TESTRAIL_KEY | TestRail user password | +| TESTRAIL_USER | TestRail user email address | + + + +## How to use + +To get test cases marked as success or fail on TestRail we have to add tags with TestRail test case ID +on each scenario. + +Test case tag structure: + +`prefix` + `test case id` + +`@testrail-` + `C1104` + +See example below: + +```gherkin +Feature: Log in and out + + Background: + Given I am logged out from Hub + And I navigate to the home page + + @testrail-C1104 + @testrail-C45933 + Scenario: Admin can login + When I enter the username admin + And I enter the password admin + And I click the Login button + Then I see the admin's landing page +``` + +Note: some scenarios can cover multiple TestRail cases, for that you just need to add multiple tags. + +## How to contribute + +### Install dependencies for development + +``` +pipenv install --dev +``` + +### How to run tests + +Activate your virtual environment and then just run tox. +``` +tox +``` + +## How to distribute + +If you need to publish a new version of this package you can use this command: + +``` +python setup.py sdist bdist_wheel +twine upload dist/* +``` + + +# License +Licensed under `MIT license`. View [license](LICENSE). + + + + +%package help +Summary: Development documents and examples for behave-testrail-reporter +Provides: python3-behave-testrail-reporter-doc +%description help +# Behave to TestRail Reporter + + +[](https://circleci.com/gh/Virtualstock/behave-testrail-reporter) +[](https://www.codacy.com/app/Virtualstock/behave-testrail-reporter?utm_source=github.com&utm_medium=referral&utm_content=Virtualstock/behave-testrail-reporter&utm_campaign=Badge_Grade) +[](https://www.codacy.com/app/Virtualstock/behave-testrail-reporter?utm_source=github.com&utm_medium=referral&utm_content=Virtualstock/behave-testrail-reporter&utm_campaign=Badge_Coverage) +[](https://pullreminders.com?ref=badge) + +This integration is used to add test results to TestRail automatically when Behave tests are executed. + + +Example of the generated report: + +``` +3 testrail test cases passed, 0 failed, 19 skipped, 2 untested +Took 0m6.349s +``` + +## Install + +Can install it using pipenv + +``` +$ pipenv install behave-testrail-reporter +``` + +or using pip + +``` +$ pip install behave-testrail-reporter +``` + +## Setup + +Add `TestrailReporter` to behave reporters in your `/features/environment.py` by adding this code in `before_all()` + +```python +from behave_testrail_reporter import TestrailReporter + +def before_all(context): + # ... all your other awesome code in here + current_branch = os.environ.get('CIRCLE_BRANCH') # Change this to get the current build branch of your CI system + testrail_reporter = TestrailReporter(current_branch) + context.config.reporters.append(testrail_reporter) +``` + + +Create a `testrail.yml` config file in the root of your project + + +Example structure: + + +```yaml +base_url: https://your-domain.testrail.io +projects: + - name: 'Advanced tests on branch {branch}' + id: 123 + suite_id: 456 + # note: this will allow any branch to push test case results to Testrail. + allowed_branch_pattern: '.*' + - name: 'Smoke tests on branch {branch}' + id: 1234 + suite_id: 789 + # note: this will allow any branch to push test case results to Testrail. + allowed_branch_pattern: '.*' +``` + +Allow only **master** branch and **release1.111.1** to push test results to Testrail: +```yaml +base_url: https://your-domain.testrail.io +projects: + - name: 'Full E2E tests on branch {branch}' + id: 123 + suite_id: 456 + allowed_branch_pattern: '^(master|release\/\d+([\.\d]+)?)$' +``` + +| yaml key | Description | +| ---------------------- | ---------------------------------------------------------- | +| name | Project name | +| id | Testrail project id | +| suite_id | Testrail Suite id | +| allowed_branch_pattern | Regular expression to restrict when a test run is executed | + +**name** - You can use some project variables to create dynamic test run names + +| Variable | Example | Result | +| ------------ | ----------------------- | --------------- | +| {project_id} | 'Test run {project_id}' | Test run 123 | +| {suite_id} | 'Test run {suite_id}' | Test run 456 | +| {branch} | 'Test run {branch}' | Test run master | + + +**Environment variables required** + +| Variable name | Description | +| ------------------- | --------------------------- | +| TESTRAIL_KEY | TestRail user password | +| TESTRAIL_USER | TestRail user email address | + + + +## How to use + +To get test cases marked as success or fail on TestRail we have to add tags with TestRail test case ID +on each scenario. + +Test case tag structure: + +`prefix` + `test case id` + +`@testrail-` + `C1104` + +See example below: + +```gherkin +Feature: Log in and out + + Background: + Given I am logged out from Hub + And I navigate to the home page + + @testrail-C1104 + @testrail-C45933 + Scenario: Admin can login + When I enter the username admin + And I enter the password admin + And I click the Login button + Then I see the admin's landing page +``` + +Note: some scenarios can cover multiple TestRail cases, for that you just need to add multiple tags. + +## How to contribute + +### Install dependencies for development + +``` +pipenv install --dev +``` + +### How to run tests + +Activate your virtual environment and then just run tox. +``` +tox +``` + +## How to distribute + +If you need to publish a new version of this package you can use this command: + +``` +python setup.py sdist bdist_wheel +twine upload dist/* +``` + + +# License +Licensed under `MIT license`. View [license](LICENSE). + + + + +%prep +%autosetup -n behave-testrail-reporter-0.5.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-behave-testrail-reporter -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.1-1 +- Package Spec generated @@ -0,0 +1 @@ +ae274572afd20268b3d89f650682ad0a behave-testrail-reporter-0.5.1.tar.gz |
