API
Models
Module to provide helper function for JSON schema validation.
- class ska_ser_xray.validation.ValidatedData(json_file, json_schema, model)
Class to access JSON data provided from a json file.
This automatically validates the JSON schema (see …) of the file and proxies to its data model.
- ska_ser_xray.validation.validated_json_object(json_file, schema, model)
Return a validate instance of the given model.
Auto-generated data models from json schemas.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"tag": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"line": {
"type": "integer"
}
},
"required": ["name"]
},
"feature": {
"type": "object",
"properties": {
"uri": {
"type": "string"
},
"keyword": {
"type": "string"
},
"name": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/tag"
}
},
"elements": {
"type": "array",
"items": {
"$ref": "#/definitions/element"
}
}
},
"required": ["name", "uri"]
},
"element": {
"type": "object",
"properties": {
"keyword": {
"type": "string"
},
"type": {
"type": "string"
},
"id": {
"type": "string"
},
"line": {
"type": "integer"
},
"name": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/tag"
}
},
"steps": {
"type": "array",
"items": {
"$ref": "#/definitions/step"
}
}
},
"required": ["type", "line", "name"]
},
"step": {
"type": "object",
"properties": {
"keyword": {
"type": "string"
},
"line": {
"type": "integer"
},
"name": {
"type": "string"
},
"hidden": {
"type": "boolean"
},
"result": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"passed", "Passed", "PASSED",
"failed", "Failed", "FAILED",
"undefined", "Undefined", "UNDEFINED",
"skipped", "Skipped", "SKIPPED",
"pending", "Pending", "PENDING",
"ambiguous", "Ambiguous", "AMBIGUOUS"
]
},
"duration": {
"type": "number"
},
"error_message": {
"type": "string"
}
},
"required": ["status"],
"if": {
"properties": { "status": { "pattern": "^(?:f|F)(?:ailed|AILED)$" } }
},
"then": {
"required": ["error_message"]
}
}
},
"required": ["keyword"],
"if": {
"not": {
"properties": { "hidden": { "const": true } },
"required": ["hidden"]
}
},
"then": {
"required": ["line"]
}
}
},
"type": "array",
"items": {
"$ref": "#/definitions/feature"
}
}
- class ska_ser_xray.models.junit.Error(*, type_value=None, message=None, content=<factory>)
- class ska_ser_xray.models.junit.Failure(*, type_value=None, message=None, content=<factory>)
- class ska_ser_xray.models.junit.Properties(*, property=<factory>)
- class ska_ser_xray.models.junit.Property(*, name, value)
- class ska_ser_xray.models.junit.Skipped(*, message=None)
- class ska_ser_xray.models.junit.SystemErr(*, value='')
- class ska_ser_xray.models.junit.SystemOut(*, value='')
- class ska_ser_xray.models.junit.Testcase(*, properties=None, skipped=None, error=None, failure=<factory>, system_out=<factory>, system_err=<factory>, name, assertions=None, time, classname=None, status=None)
- class ska_ser_xray.models.junit.Testsuite(*, properties=None, testcase=<factory>, system_out=None, system_err=None, tests, failures, errors, skipped=None, time, name, timestamp, hostname)
- class ska_ser_xray.models.junit.Testsuites(*, testsuite=<factory>)
Module containing information about the test result.
- class ska_ser_xray.test_result_info.TestFramework(value)
Supported test frameworks.
- class ska_ser_xray.test_result_info.TestResultInfo(**data)
Model to capture test result information.
Data objects from JSON
This module implements access to the metadata provided for JIRA issues.
- class ska_ser_xray.execution_configuration_data.ExecutionConfigurationData(json_file)
Class to access JIRA/xray metadata provided from a json file.
This automatically validates the JSON schema (see …) of the file and proxies to its data model.
- property chart_info: Path
Get the Path to the helm chart.
This is matching the configuration to the environment (variables) given to the process.
- Returns:
the name project Id string
- property description: str
Get the description for the test execution.
This is matching the configuration to the environment (variables) given to the process.
- Returns:
the description representation for JIRA
- property env_variables: List[Tuple[str, str]]
Get the a list of environment variables.
This is matching the configuration to the environment (variables) given to the process.
- Returns:
list of (env_name, env_value) tuples
- get_customissue_mapping()
Get the mapping from human readable to JIRA customissue_id.
- get_test_plans(report_tags)
Get the test plan (ids) matching the given report_tags.
- property issuetype_id: int
Get the issuetype id to work with.
- Returns:
id of XRAY issue type (e.g. for Test Execution)
- property labels: List[str]
Get the list of labels.
This is matching the configuration from the environment (variables) given to the process.
- Returns:
list of JIRA version numbers, e.g. the git branch
- property name: str
Get the name for the test execution.
This is matching the configuration to the environment (variables) given to the process.
- Returns:
the name representation for JIRA
- property project_id: str
Get the JIRA project Id for the test execution.
- Returns:
the name project Id string
- property summary: str
Get a summary of metadata for the JIRA execution.
- Returns:
multi-line string of info
- property test_environments: List[str]
Get the list of test environments.
This is matching the configuration from the environment (variables) given to the process.
- Returns:
list of Test environments, e.g. “[PI15]”
- ska_ser_xray.execution_configuration_data.evaluate_from_env(spec)
Evaluate against os.environ settings.
- ska_ser_xray.execution_configuration_data.evaluate_from_tags(spec, tags)
Evaluate against given tags.
This module implements access to the JIRA issue update data.
- class ska_ser_xray.jira_info_data.FieldModel(**data)
Inner field model for JIRA json message.
- class ska_ser_xray.jira_info_data.JiraInfoData(data, mapping)
Simplified access class for JiraInfo.
- class ska_ser_xray.jira_info_data.JiraInfoModel(**data)
The model for the JIRA Test Execution info.
JIRA/XRAY upload
Utilities to handle xray multipart uploads.
- class ska_ser_xray.upload.upload_multipart.CucumberUploader(connection)
Uploader that imports Cucumber test results into JIRA.
- upload(test_result_info, jira_info, skip_upload=False)
Upload the given test results.
- Parameters:
test_result_info (
TestResultInfo
) – information about the test resultjira_info (
JiraInfoData
) – JIRA info dataskip_upload (
bool
) – generate info but don’t upload
- Return type:
- Returns:
the response items from call
- class ska_ser_xray.upload.upload_multipart.JUnitXmlUploader(connection)
Uploader that imports JUnit XML test results into JIRA.
- upload(test_result_info, jira_info, skip_upload=False)
Upload the given test results.
- Parameters:
test_result_info (
TestResultInfo
) – information about the test resultjira_info (
JiraInfoData
) – JIRA info dataskip_upload (
bool
) – generate info but don’t upload
- Return type:
- Returns:
the response items from call
- class ska_ser_xray.upload.upload_multipart.RobotUploader(connection)
Uploader that imports Robot Framework test results into JIRA.
- upload(test_result_info, jira_info, skip_upload=False)
Upload the given test results.
- Parameters:
test_result_info (
TestResultInfo
) – information about the test resultjira_info (
JiraInfoData
) – JIRA info dataskip_upload (
bool
) – generate info but don’t upload
- Return type:
- Returns:
the response items from call
- class ska_ser_xray.upload.upload_multipart.Uploader
Abstract base class for test result uploaders.
- abstract upload(test_result_info, jira_info, skip_upload=False)
Upload the given test results.
- Parameters:
test_result_info (
TestResultInfo
) – information about the test resultjira_info (
JiraInfoData
) – JIRA info dataskip_upload (
bool
) – generate info but don’t upload
- Return type:
- Returns:
the response items from call
- ska_ser_xray.upload.upload_multipart.get_uploader(test_framework, connection)
Get the uploader for the given test framework.
- Parameters:
test_framework (
TestFramework
) – the test framework to construct the uploader forconnection (
Connection
) – the JIRA connection to use for the upload
- Return type:
- Returns:
Uploader
Module to create JIRA endpoint connections.
- class ska_ser_xray.upload.multipart_connection.Connection(host, token)
JIRA connection object.
- push_multipart(endpoint, *parts, skip_upload=False)
Push results to JIRA.
- Parameters:
- Raises:
UploadError – if anything goes wrong
- Return type:
- Returns:
status report from JIRA
- class ska_ser_xray.upload.multipart_connection.MultiPartResults(**data)
Model to capture upload results.
- class ska_ser_xray.upload.multipart_connection.Part(**data)
Model to pass a part of multipart data.
- exception ska_ser_xray.upload.multipart_connection.UploadError
Exception to raise when upload fails.
Cucumber support
Module to parse test result information from Cucumber results.
- ska_ser_xray.cucumber.get_test_result_info.get_test_result_info(results_file, exec_config_data)
Get the test result information from a Cucumber results file.
- Parameters:
results_file (
Path
) – Path to the Cucumber results fileexec_config_data (
ExecutionConfigurationData
) – Execution configuration data
- Return type:
- Returns:
test result information.
This module implements access to the pytest report data for JIRA issues.
- class ska_ser_xray.cucumber.pytest_report_data.PytestReportData(json_file)
Class to access pytest test report data from a JSON file.
This automatically validates the JSON schema (see …) of the file and proxies to its data model.
- get_start_end_dates()
Get the start and end dates for the test report.
This module implements access to the cucumber results for JIRA issues.
- class ska_ser_xray.cucumber.cucumber_data.CucumberData(json_file)
Class to access cucumber JSON data provided from a json file.
This automatically validates the JSON schema (see …) of the file and proxies to its data model.
Robot Framework support
Module to parse test result information from Robot Framework results.
- class ska_ser_xray.robot.get_test_result_info.ExecutionInfoCollector
Collect execution information about the test result.
- end_suite(suite)
Visit each suite to determine the lowest starttime and highest endtime.
- end_test(test)
Visit each test to determine the lowest starttime and highest endtime.
- class ska_ser_xray.robot.get_test_result_info.TestTagCollector
Collect tags shared by all tests in the suite.
Pytest JUnit support
Module to parse test result information from pytest results.
- class ska_ser_xray.pytest.get_test_result_info.ExecutionInfoCollector
Collect execution information about the test suites.
- collect(suite)
Collect execution info from the given test suite.
- class ska_ser_xray.pytest.get_test_result_info.TestPlanTagCollector
Collect test plan tags from the test suites.
- collect(suite)
Collect test plan tags from the given test suite.