Core
Classes related to the core functionality of the framework. Documentation for the test runner, reporting, test cases and general project organization.
Test reporter
- class test_reporter.TestReporter
Manages test suite and test case result collection and tracking
- _add_external_test_case_ids(test_case, case_ids)
Associates external tracking case identifiers with specified test case
- Parameters:
test_case (QLTYTestCase) – Test case instance extending unittest TestCase
case_ids (list) – List of test case identifiers for external tracking
- _add_test_case(test_case, feature_name, test_target)
Creates new test case entry in results dictionary
- Parameters:
test_case (QLTYTestCase) – Test case instance extending unittest TestCase
- _get_failed_results(result_list)
Extracts result data from failed and error test cases
- Parameters:
result_list (list) – List of tuples containing (test case, stack trace)
- add_test_case_result(test_case_result)
Records test case execution results Only successful passes are recorded here; failures captured at test run completion
- Parameters:
test_case_result (QLTYTestCase) – Test case instance extending unittest TestCase
- external_case_ids = {}
Dictionary storing external test case identifiers
- get_results(results)
Extracts failure and error results from test execution
- Parameters:
results (TextTestResult) – unittest TextTestResult object
- register_test_case(test_case, case_ids, feature_name, test_target)
Registers test case with associated metadata for reporting
- Parameters:
test_case (QLTYTestCase) – Test case instance extending unittest TestCase
case_ids (list) – List of test case identifiers for external tracking
feature_name (String) – Feature identifier for this test case
test_target (Enum[TestTarget]) – Test execution target (UI or API)
- test_results = {}
Dictionary containing results for all test cases
Test runner utils
- class test_runner_utils.TestRunnerUtils
Utility class for configuration validation and test run lifecycle management
- static _report_to_testrail(test_results, test_run_id, test_run_elapsed_time)
Submits test results to TestRail test management system. Creates a single test run containing all test case IDs.
- Parameters:
test_results (dict) – Collection of test execution results
test_run_id (str) – Unique test run identifier
test_run_elapsed_time (float) – Total test run duration in seconds
- Returns:
TestRail run ID, or None if reporting was skipped
- Return type:
int or None
- static generate_test_run_id()
Generates unique identifier string for test run
- Returns:
Test run identifier string
- Return type:
str
- static get_readable_run_time(test_run_time)
Converts test run duration to human-readable format (e.g., 1h 12m 34s)
- Parameters:
test_run_time – Test run duration in seconds
- Returns:
Formatted duration string
- Return type:
String
- static get_testrun_totals(test_results)
Generates consolidated test case execution statistics
Example output:
results = { 'total_testcases': 0, 'passed_testcases': 0, 'failed_testcases': 0 }
- Parameters:
test_results – Collection of executed test cases
- Type:
Dictionary
- Returns:
Consolidated statistics dictionary
- Return type:
Dictionary
- static report(test_results, test_run_id, test_run_elapsed_time)
Distributes results to enabled integration systems
- Parameters:
test_results (dict) – Collection of test execution results
test_run_id (str) – Unique test run identifier
test_run_elapsed_time (datetime) – Total test run duration
- static running_on_android()
Checks if current test run targets Android platform
- Returns:
True if Android execution, False otherwise
- Return type:
bool
- running_on_android_message = 'Android test cases only, skipping'
Console message for Android-only test execution
- static running_on_android_web()
Checks if current test run targets Chrome mobile for Android
- Returns:
True if Android web execution, False otherwise
- Return type:
bool
- running_on_android_web_message = 'Chrome mobile for Android only, skipping'
Console message for Android web test execution
- static running_on_ios()
Checks if current test run targets iOS platform
- Returns:
True if iOS execution, False otherwise
- Return type:
bool
- running_on_ios_message = 'iOS test cases only, skipping'
Console message for iOS-only test execution
- static running_on_ios_web()
Checks if current test run targets Safari mobile for iOS
- Returns:
True if iOS web execution, False otherwise
- Return type:
bool
- running_on_ios_web_message = 'Safari for iOS only, skipping'
Console message for iOS web test execution
QLTY test case
- class qlty_testcase.QLTYTestCase(methodName='runTest')
Base test case class for QLTY test implementations Extends unittest.TestCase with framework-specific functionality
- _classSetupFailed = False
- _class_cleanups = []
- collect_logs = True
Flag to enable/disable log collection during tearDown
- drivers = []
Collection of webdriver instances for application interaction
- get_driver()
Retrieves webdriver for page object instantiation Not intended for use with managed drivers feature
- setUp()
Initializes webdriver instance for test case execution
- tearDown()
Terminates webdriver sessions and handles result reporting Reports to Saucelabs if integration is enabled
- qlty_testcase.tag(*tags)
Decorator that tags a test class for filtering. Tagged classes can be included or excluded via –tag and –exclude-tag CLI flags. Tags listed in settings.PROJECT_CONFIG[‘DEFAULT_EXCLUDE_TAGS’] are auto-excluded from default runs unless overridden by –tag.
Usage:
@tag('production') class TestDynamicRegistration(QLTYTestCase): ... @tag('smoke', 'fast') class TestLogin(QLTYTestCase): ...
- Parameters:
tags (str) – One or more tag strings