-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from nassauwinter/main
Make dev up-to-date with main branch
- Loading branch information
Showing
26 changed files
with
946 additions
and
87 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
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 |
---|---|---|
|
@@ -14,6 +14,3 @@ pylint = "*" | |
build = "*" | ||
twine = "*" | ||
tox-gh-actions = "*" | ||
|
||
[requires] | ||
python_version = "3.8" |
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,5 @@ | ||
## Reporting to Zephyr | ||
|
||
- The Cucumber format is different from Behave reporter format. | ||
In case you want to report test executions from output Behave file, | ||
please use some custom formatter for Behave output, i.e. https://pypi.org/project/behave-cucumber-formatter/. |
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 @@ | ||
0.0.3 |
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,72 @@ | ||
""" | ||
Usage examples of Zephyr Scale Server API wrappers. | ||
""" | ||
import logging | ||
|
||
from zephyr import ZephyrScale | ||
|
||
|
||
# Enable logging with level Debug for more verbosity | ||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
|
||
# Specify your Jira context to operate with: | ||
base_url = "https://http://localhost:2990/jira/rest/atm/1.0/" | ||
|
||
|
||
# Deside the type of authorization. It could be a token, username/password or cookies | ||
auth = {"token": "<your_jira_token>"} | ||
# auth = {"username": "<your_username>", "password": "your_pass"} | ||
# auth = {"cookies": "<your_cookie_dict>"} | ||
|
||
# Create an instance of Zephyr Scale | ||
zscale = ZephyrScale.server_api(base_url=base_url, **auth) | ||
|
||
|
||
# Now we can start playing with the Zephyr API! | ||
test_cases = zscale.api.test_cases | ||
|
||
# Get a test case: | ||
case_data = test_cases.get_test_case("<your_case_id>") | ||
|
||
# Create a test case: | ||
creation_data = test_cases.create_test_case("<your_project_key>", "Test case name") | ||
|
||
# Update a test case: | ||
test_script = { | ||
"type": "STEP_BY_STEP", | ||
"steps": [ | ||
{ | ||
"description": "Description for the step 1", | ||
"testData": "Some test data", | ||
"expectedResult": "Expectations" | ||
}, | ||
{ | ||
"description": "Step 2 description", | ||
"testData": "Some more test data", | ||
"expectedResult": "Expected result for the step 2" | ||
}]} | ||
update_data = test_cases.update_test_case("<your_case_id>", | ||
objective=f"New_test_objective", | ||
testScript=test_script) | ||
|
||
# Delete a test case: | ||
deleted = test_cases.delete_test_case("<case_id_you_don't_need_anymore>") | ||
|
||
# Get test case attachments: | ||
attachments = test_cases.get_attachments("<your_case_id>") | ||
|
||
# Create a test case attachment (upload): | ||
upload_result = test_cases.create_attachment("<your_case_id>", "path_to_attachment_file") | ||
|
||
# Get the latest execution result for the test case: | ||
execution_data = test_cases.get_latest_result("<your_case_id>") | ||
|
||
# Get attachments for a specified step: | ||
test_cases.get_step_attachments("<your_case_id>", "<step_id>") | ||
|
||
# Create an attachment for step: | ||
test_cases.create_step_attachment("<your_case_id>", "<step_id>", "path_to_attachment_file") | ||
|
||
# Search test cases with JQL: | ||
search = test_cases.search_cases(query='projectKey = "<your_awesome_porojects_key>"') |
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,9 @@ | ||
[pytest] | ||
markers = | ||
unit: test Zephyr Scale modules | ||
integration: test integration with Server/Cloud | ||
|
||
log_cli = True | ||
log_cli_level = DEBUG | ||
log_cli_format = %(asctime)s %(levelname)s %(message)s | ||
log_cli_date_format = %Y-%m-%d %H:%M:%S |
This file was deleted.
Oops, something went wrong.
Empty file.
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,63 @@ | ||
from logging import Logger | ||
|
||
import pytest | ||
|
||
from zephyr.scale.scale import DEFAULT_BASE_URL, ZephyrScale | ||
|
||
|
||
ZSESSION_PATH = "zephyr.scale.scale.ZephyrSession" | ||
CLOUD_API_WRAP_PATH = "zephyr.scale.scale.CloudApiWrapper" | ||
SERVER_API_WRAP_PATH = "zephyr.scale.scale.ServerApiWrapper" | ||
|
||
|
||
@pytest.mark.unit | ||
class TestZephyrScale: | ||
@pytest.mark.parametrize("creation_kwargs, exp_url", [({}, DEFAULT_BASE_URL), | ||
({"base_url": DEFAULT_BASE_URL}, DEFAULT_BASE_URL), | ||
({"base_url": "test.com"}, "test.com")]) | ||
def test_scale_session_creation(self, creation_kwargs, exp_url, mocker): | ||
session_mock = mocker.patch(ZSESSION_PATH) | ||
mocker.patch(CLOUD_API_WRAP_PATH) | ||
|
||
ZephyrScale(**creation_kwargs) | ||
|
||
session_mock.assert_called_once_with(base_url=exp_url) | ||
|
||
@pytest.mark.parametrize("creation_kwargs, api_version", [({}, CLOUD_API_WRAP_PATH), | ||
({"api_version": "v2"}, CLOUD_API_WRAP_PATH), | ||
({"api_version": "V2"}, CLOUD_API_WRAP_PATH), | ||
({"api_version": "v1"}, SERVER_API_WRAP_PATH), | ||
({"api_version": "V1"}, SERVER_API_WRAP_PATH)]) | ||
def test_scale_defining_version(self, creation_kwargs, api_version, mocker): | ||
zsession_mock = mocker.patch(ZSESSION_PATH) | ||
wrapper_mock = mocker.patch(api_version) | ||
|
||
zephyr = ZephyrScale(**creation_kwargs) | ||
|
||
assert isinstance(zephyr, ZephyrScale), f"Resulted object should be instance of {ZephyrScale}" | ||
wrapper_mock.assert_called_once_with(zsession_mock()) | ||
|
||
@pytest.mark.parametrize("creation_kwargs, api_version", [({"base_url": "test.com"}, SERVER_API_WRAP_PATH)]) | ||
def test_server_cls_method(self, creation_kwargs, api_version, mocker): | ||
zsession_mock = mocker.patch(ZSESSION_PATH) | ||
wrapper_mock = mocker.patch(api_version) | ||
|
||
zephyr = ZephyrScale.server_api(**creation_kwargs) | ||
assert isinstance(zephyr, ZephyrScale), f"Resulted object should be instance of {ZephyrScale}" | ||
wrapper_mock.assert_called_once_with(zsession_mock()) | ||
|
||
@pytest.mark.parametrize("creation_kwargs, exception", | ||
[({"api_version": "v"}, ValueError)]) | ||
def test_scale_defining_version_exceptions(self, creation_kwargs, exception, mocker): | ||
mocker.patch(ZSESSION_PATH) | ||
|
||
with pytest.raises(exception): | ||
ZephyrScale(**creation_kwargs) | ||
|
||
def test_scale_logger(self, mocker): | ||
mocker.patch(ZSESSION_PATH) | ||
mocker.patch(CLOUD_API_WRAP_PATH) | ||
|
||
zephyr = ZephyrScale() | ||
|
||
assert isinstance(zephyr.logger, Logger) |
Oops, something went wrong.