export test case file and test cycle file for teko-tool push to jira
Project description
JIRA EXPORT TEST TO FILE PYTHON
Push test to Jira
1. Requirement
- Python 3
- pytest package
2. Set up
pip install --upgrade teko-export-test
- Add to test setting
pytest_plugins = ['export_test_jira.tool']
. Example, add toconftest.py
:
3. Write test function, Example
- To import decorator:
from export_test_jira.wraper import jira_test
- To use test script STEP_BY_STEP:
from export_test_jira.models.test_step import TestStep
# coding=utf-8
import logging
from export_test_jira.wraper import jira_test
from export_test_jira.models.test_step import TestStep
__author__ = 'Dungntc'
_logger = logging.getLogger(__name__)
@jira_test(
issue_links=['TESTING-9'],
objective='Make sure that not allow create message when exists msg with same brand',
scripts=[
TestStep(
description='Create a new campaign',
expected_result='create fake_campaign success',
test_data='None'
),
TestStep(
description='Get a template from User Notification services',
expected_result='get fake_template success',
test_data='None'
),
TestStep(
description='Create 2 message with a template_id and XXX brand for this campaign',
expected_result='Conflict error',
test_data='''campaign_id = fake_campaign.id,
msg_template_id = fake_template.id ,
msg_params= fixed, brand = XXX'''
),
TestStep(
description='Get a template from User Notification services',
expected_result='number of msg in db is 1',
test_data='message1'
)
]
)
def test_create_campaign_msg_fail_when_duplicate_brand():
print('Hello everyone, test case for TESTING-9')
assert 409 == 409
@jira_test(
issue_links=['TESTING-9', 'TESTING-10'],
objective='Make sure that not allow create message when exists msg with same brand',
confluence_links=['https://confluence.teko.vn/display/EP/Archive',
'https://confluence.teko.vn/display/EP/Data+Flow+Diagrams'],
web_links=['dungntc.com', 'google.com'],
folder='/Mkt Portal Test/Campaign msg test',
plan='Create fake campaign and get a fake template. Then call api create message'
)
def test_create_campaign_msg_success():
print('Hello everyone, test case for TESTING-9, TESTING-10')
assert 409 == 409
4 Maybe you need push test to Jira with teko-tool, this is example gitlab-ci.yml
test:unittest:
stage: test
...
variables:
JIRA_TEST_CASE_ARTIFACT: test_case.json
JIRA_TEST_CYCLE_ARTIFACT: test_cycle.json
artifacts:
paths:
- $JIRA_TEST_CASE_ARTIFACT
- $JIRA_TEST_CYCLE_ARTIFACT
expire_in: 1 week
allow_failure: false
- Enviroment:
$JIRA_TEST_CASE_ARTIFACT
: test_case file path, default is test_case.json$JIRA_TEST_CYCLE_ARTIFACT
: test_cycle file path, default is test_cycle.json
report:push-test:
stage: report
image: python:3.7-slim
variables:
JIRA_TEST_CASE_ARTIFACT: test_case.json
JIRA_TEST_CYCLE_ARTIFACT: test_cycle.json
JIRA_PROJECT_KEY: TESTING
JIRA_SERVER: jira.teko.vn
#JIRA_USERNAME
#JIRA_PASSWORD
script:
- pip install --upgrade --cache-dir=.pip teko-cli
- teko jira create-tests $JIRA_TEST_CASE_ARTIFACT
- teko jira create-cycle $JIRA_TEST_CYCLE_ARTIFACT
cache:
key: pip-cache
paths: [ .pip ]
allow_failure: true
when: always
- Enviroment:
$JIRA_TEST_CASE_ARTIFACT
: test_case file path, default is test_case.json$JIRA_TEST_CYCLE_ARTIFACT
: test_cycle file path, default is test_cycle.json$JIRA_SERVER
: jira.teko.vn$JIRA_PROJECT_KEY
: TESTING$JIRA_USERNAME
: tekobot$JIRA_PASSWORD
: *****
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
teko-export-test-0.0.1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for teko_export_test-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fb644ec1c302dbb007d5ea26cdb1367307f36679d5261ff40dafaac877aea49 |
|
MD5 | 88a801097a4c08e513c845823e8bfd9a |
|
BLAKE2b-256 | f6954edadce07e6d0581debb4083ddcdae656143ee452339bfe213cf0a10dc50 |