API
Validation
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"
}
}
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.
- Return type
- 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.
- Return type
- 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.
- 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.
- Return type
- 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.
- property name: str
Get the name for the test execution.
This is matching the configuration to the environment (variables) given to the process.
- Return type
- Returns
the name representation for JIRA
- property project_id: str
Get the JIRA project Id for the test execution.
- Return type
- Returns
the name project Id string
- property summary: str
Get a summary of metadata for the JIRA execution.
- Return type
- 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.
- 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 pytest report data for JIRA issues.
- class ska_ser_xray.report_data.ReportData(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_formatted_dates()
Get the start/end dates for the test report as ISO formatted string.
- 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_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.
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.
- ska_ser_xray.upload.upload_multipart.get_info(test_exec_path, test_results_path)
Assemble and return dictionary for multipart xray info field.
- ska_ser_xray.upload.upload_multipart.upload_multipart(host, token, results_file, test_exec_desc_file, skip_upload=False)
Perform a multipart upload.
- Parameters
- Return type
- Returns
the response items from call
Module to create JIRA endpoint connections.
- class ska_ser_xray.upload.multipart_connection.Connection(host, token)
JIRA connection object.
- push_multipart(*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.