Skip to content
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ You can use environment variable to control certain features of testomat.io
| TESTOMATIO_RUNGROUP_TITLE | Create a group (folder) for a test run. If group already exists, attach test run to it | TESTOMATIO_RUNGROUP_TITLE="Release 2.0" pytest --testomatio report |
| TESTOMATIO_ENV | Assign environment to a test run, env variant of **testRunEnv** option. Has a lower precedence than **testRunEnv** option. | TESTOMATIO_ENV="linux,chrome,1920x1080" pytest --testomatio report |
| TESTOMATIO_LABEL | Assign labels to a test run. Labels must exist in project and their scope must be enabled for runs | TESTOMATIO_LABEL="smoke,regression" pytest --testomatio report |
| TESTOMATIO_JIRA_ID | Assigns Test Run to Jira Issue. Note: Issue must exist on Jira and Jira Integration must be configured for project on Testomat.io | TESTOMATIO_JIRA_ID=TES-1 pytest --testomatio report |
| TESTOMATIO_UPDATE_CODE | Send code of your test to Testomat.io on each run. If not enabled(default) assumes the code is pushed using **sync** command | TESTOMATIO_UPDATE_CODE=True pytest --testomatio report |
| TESTOMATIO_EXCLUDE_SKIPPED | Exclude skipped tests from the report | TESTOMATIO_EXCLUDE_SKIPPED=1 pytest --testomatio report |
| TESTOMATIO_PUBLISH | Publish run after reporting and provide a public URL | TESTOMATIO_PUBLISH=true pytest --testomatio report |
Expand Down
6 changes: 4 additions & 2 deletions pytestomatio/connect/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,15 @@ def get_tests(self, test_metadata: list[TestItem]) -> dict:
log.error('Failed to get test ids from testomat.io')


def create_test_run(self, access_event: str, title: str, group_title, env: str, label: str, shared_run: bool, shared_run_timeout: str,
def create_test_run(self, access_event: str, title: str, group_title, jira_id: str, env: str, label: str, shared_run: bool, shared_run_timeout: str,
parallel, ci_build_url: str) -> dict | None:
request = {
"access_event": access_event,
"api_key": self.api_key,
"title": title,
"group_title": group_title,
"env": env,
"jira_id": jira_id,
"label": label,
"parallel": parallel,
"ci_build_url": ci_build_url,
Expand All @@ -213,14 +214,15 @@ def create_test_run(self, access_event: str, title: str, group_title, env: str,
return response.json()
self._show_status_message(response.status_code)

def update_test_run(self, id: str, access_event: str, title: str, group_title,
def update_test_run(self, id: str, access_event: str, title: str, group_title, jira_id: str,
env: str, label: str, shared_run: bool, shared_run_timeout: str, parallel, ci_build_url: str) -> dict | None:
request = {
"access_event": access_event,
"api_key": self.api_key,
"title": title,
"group_title": group_title,
"env": env,
"jira_id": jira_id,
"label": label,
"parallel": parallel,
"ci_build_url": ci_build_url,
Expand Down
2 changes: 2 additions & 0 deletions pytestomatio/testomatio/testRunConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self):
self.exclude_skipped = exclude_skipped
self.label = safe_string_list(os.environ.get('TESTOMATIO_LABEL'))
self.group_title = os.environ.get('TESTOMATIO_RUNGROUP_TITLE')
self.jira_id = os.environ.get('TESTOMATIO_JIRA_ID')
# This allows to report tests to the test run by it's id. https://docs.testomat.io/getting-started/running-automated-tests/#reporting-parallel-tests
self.parallel = False if shared_run else True
# This allows using test run title to group tests under a single test run. This is needed when running tests in different processes or servers.
Expand All @@ -45,6 +46,7 @@ def to_dict(self) -> dict:
result['title'] = self.title
result['group_title'] = self.group_title
result['env'] = self.environment
result['jira_id'] = self.jira_id
result['label'] = self.label
result['parallel'] = self.parallel
result['shared_run'] = self.shared_run
Expand Down
7 changes: 6 additions & 1 deletion tests/test_connect/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ def test_create_test_run_success(self, mock_post, connector):
group_title="Group 1",
env="linux,chrome",
label="smoke",
jira_id="tes-1",
shared_run=False,
shared_run_timeout="2",
parallel=True,
Expand All @@ -321,6 +322,7 @@ def test_create_test_run_success(self, mock_post, connector):
"title": "Test Run",
"group_title": "Group 1",
"env": "linux,chrome",
"jira_id": "tes-1",
"label": "smoke",
"shared_run": False,
"shared_run_timeout": "2",
Expand All @@ -345,6 +347,7 @@ def test_create_test_run_filters_none_values(self, mock_post, connector):
group_title=None,
env=None,
label="smoke",
jira_id=None,
shared_run=False,
shared_run_timeout=None,
parallel=True,
Expand All @@ -366,7 +369,7 @@ def test_create_test_run_http_error(self, mock_post, connector):
"""Test HTTP error handled wher create test run"""
mock_post.side_effect = HTTPError("HTTP Error")

result = connector.create_test_run("Test", None, None, None, None, False, True, None, None)
result = connector.create_test_run("Test", None, None, None, None, None, False, True, None, None)
assert result is None

@patch('requests.Session.put')
Expand All @@ -383,6 +386,7 @@ def test_update_test_run_success(self, mock_put, connector):
title="Updated Run",
group_title="Group",
env="windows",
jira_id="tes-1",
label="regression",
shared_run=True,
shared_run_timeout='2',
Expand All @@ -398,6 +402,7 @@ def test_update_test_run_success(self, mock_put, connector):
"title": "Updated Run",
"group_title": "Group",
"env": "windows",
"jira_id": "tes-1",
"label": "regression",
"shared_run": True,
"shared_run_timeout": '2',
Expand Down
5 changes: 5 additions & 0 deletions tests/test_testomatio/test_testRunConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def test_init_default_values(self):
assert config.disable_batch is False
assert config.batch_size == DEFAULT_BATCH_SIZE
assert config.label is None
assert config.jira_id is None
assert config.group_title is None
assert config.parallel is True
assert config.shared_run is False
Expand All @@ -40,6 +41,7 @@ def test_init_with_env_variables(self):
'TESTOMATIO_ENV': 'linux,browser:chrome,1920x1080',
'TESTOMATIO_LABEL': 'smoke,regression',
'TESTOMATIO_RUNGROUP_TITLE': 'Release 2.0',
'TESTOMATIO_JIRA_ID': 'TES-1',
'TESTOMATIO_UPDATE_CODE': '1',
'TESTOMATIO_PUBLISH': '1',
'TESTOMATIO_EXCLUDE_SKIPPED': '1',
Expand All @@ -61,6 +63,7 @@ def test_init_with_env_variables(self):
assert config.group_title == 'Release 2.0'
assert config.parallel is True
assert config.shared_run is False
assert config.jira_id == 'TES-1'
assert config.update_code is True
assert config.meta == {'linux': None, 'browser': 'chrome', '1920x1080': None}

Expand Down Expand Up @@ -157,6 +160,7 @@ def test_to_dict_full_data(self):
'TESTOMATIO_LABEL': 'label1,label2',
'TESTOMATIO_RUNGROUP_TITLE': 'Group 1',
'TESTOMATIO_SHARED_RUN': 'true',
'TESTOMATIO_JIRA_ID': "TES-1",
'TESTOMATIO_SHARED_RUN_TIMEOUT': "12",
'TESTOMATIO_PUBLISH': 'true'
}
Expand All @@ -175,6 +179,7 @@ def test_to_dict_full_data(self):
'label': 'label1,label2',
'parallel': False,
'shared_run': True,
'jira_id': 'TES-1',
'shared_run_timeout': '12',
'ci_build_url': None
}
Expand Down
Loading