testplan.runnable package
Subpackages
- testplan.runnable.interactive package
- Submodules
- testplan.runnable.interactive.base
TestRunnerIHandlerTestRunnerIHandler.CONFIGTestRunnerIHandler.STATUSTestRunnerIHandler.abort_dependencies()TestRunnerIHandler.aborting()TestRunnerIHandler.all_tests()TestRunnerIHandler.all_tests_operation()TestRunnerIHandler.environment_resource_context()TestRunnerIHandler.environment_resource_operation()TestRunnerIHandler.environment_resource_start()TestRunnerIHandler.environment_resource_stop()TestRunnerIHandler.exit_codeTestRunnerIHandler.exportersTestRunnerIHandler.get_driver_info_report()TestRunnerIHandler.get_environment()TestRunnerIHandler.get_environment_context()TestRunnerIHandler.get_environment_resource()TestRunnerIHandler.http_handler_infoTestRunnerIHandler.reload()TestRunnerIHandler.reload_report()TestRunnerIHandler.reportTestRunnerIHandler.reset_all_tests()TestRunnerIHandler.reset_test()TestRunnerIHandler.run()TestRunnerIHandler.run_all_tests()TestRunnerIHandler.run_test()TestRunnerIHandler.run_test_case()TestRunnerIHandler.run_test_case_param()TestRunnerIHandler.run_test_suite()TestRunnerIHandler.setup()TestRunnerIHandler.start_environment()TestRunnerIHandler.start_resource()TestRunnerIHandler.start_test_resources()TestRunnerIHandler.start_tests()TestRunnerIHandler.stop_environment()TestRunnerIHandler.stop_resource()TestRunnerIHandler.stop_test_resources()TestRunnerIHandler.stop_tests()TestRunnerIHandler.targetTestRunnerIHandler.teardown()TestRunnerIHandler.test()TestRunnerIHandler.test_case_report()TestRunnerIHandler.test_report()TestRunnerIHandler.test_resource()TestRunnerIHandler.test_resource_operation()TestRunnerIHandler.test_resource_start()TestRunnerIHandler.test_resource_stop()
TestRunnerIHandlerConfig
- testplan.runnable.interactive.http
- testplan.runnable.interactive.reloader
- testplan.runnable.interactive.resource_loader
- testplan.runnable.interactive.base
- Module contents
- Submodules
Submodules
testplan.runnable.base module
Tests runner module.
- class testplan.runnable.base.TaskInformation(target: testplan.testing.base.Test | testplan.runners.pools.tasks.base.Task | Callable, materialized_test: testplan.testing.base.Test, uid: str, task_arguments: dict, num_of_parts: int)[source]
Bases:
object- num_of_parts: int
- task_arguments: dict
- uid: str
- class testplan.runnable.base.TestRunner(**options)[source]
Bases:
RunnableAdds tests to test
executorresources and invoke reportexporterobjects to create theTestRunnerResult.- Parameters:
name (
str) – Name of test runner.description (
str) – Description of test runner.logger_level (
int) – Logger level for stdout.runpath (
strorcallable) – Input runpath.path_cleanup (
bool) – Clean previous runpath entries.all_tasks_local (
bool) – Schedule all tasks in local poolshuffle (
listofstr) – Shuffle strategy.shuffle_seed (
float) – Shuffle seed.exporters (
list) – Exporters for reports creation.stdout_style (
Style) – Styling output options.report_dir (
str) – Report directory.xml_dir (
str) – XML output directory.pdf_path (
str) – PDF output path <PATH>/*.pdf.json_path (
str) – JSON output path <PATH>/*.json.pdf_style (
Style) – PDF creation styling options.http_url (
str) – Web url for posting test report.report_tags (
list) – Matches tests marked with any of the given tags.report_tags_all (
list) – Match tests marked with all of the given tags.merge_scheduled_parts (
bool) – Merge report of scheduled MultiTest parts.browse (
boolorNoneType) – Open web browser to display the test report.ui_port (
intorNoneType) – Port of web server for displaying test report.web_server_startup_timeout (
int) – Timeout for starting web server.test_filter (Subclass of
BaseFilter) – Tests filtering class.test_sorter (Subclass of
BaseSorter) – Tests sorting class.test_lister (Subclass of
BaseLister) – Tests listing class.verbose (
bool) – Enable or disable verbose mode.debug (
bool) – Enable or disable debug mode.timeout (
NoneTypeorint(greater than 0).) – Timeout value for test execution.abort_wait_timeout (
int) – Timeout for test runner abort.interactive_handler (Subclass of :py:class: TestRunnerIHandler <testplan.runnable.interactive.base.TestRunnerIHandler>) – Handler for interactive mode execution.
extra_deps (
listofmoduleorstr) – Extra module dependencies for interactive reload, or paths of these modules.label (
strorNoneType) – Label the test report with the given name, useful to categorize or classify similar reports .runtime_data (
dict) – Historical runtime data which will be used for Multitest auto-part and weight-based Task smart-schedulingauto_part_runtime_limit (
intorfloator literal “auto”) – The runtime limitation for auto-part taskplan_runtime_target (
intorfloator literal “auto”) – The testplan total runtime limitation for smart schedule
- Param:
file_log_level: Logger level for file.
Also inherits all
Runnableoptions.- CONFIG
alias of
TestRunnerConfig
- RESULT
alias of
TestRunnerResult
- STATUS
alias of
TestRunnerStatus
- add(target: Test | Task | Callable, resource: str | None = None) str | None[source]
Adds a
runnabletest entity, or aTask, or a callable that returns a test entity to aExecutorresource.
- add_environment(env: EnvironmentCreator, resource: Environments | None = None)[source]
Adds an environment to the target resource holder.
- Parameters:
env (Subclass of
EnvironmentCreator) – Environment creator instance.resource (Subclass of
Environments) – Target environments holder resource.
- Returns:
Environment uid.
- Return type:
str
- add_exporters(exporters: List[BaseExporter])[source]
Add a list of
report exportersfor outputting test report.- Parameters:
exporters (
listofExecutor) – Test exporters to be added.
- add_remote_service(remote_service: RemoteService)[source]
Adds a remote service
RemoteServiceobject to test runner.- Parameters:
remote_service – RemoteService object
remote_service –
RemoteService
- add_resource(resource: Resource, uid: str | None = None) str[source]
Adds a test
executorresource in the test runner environment.- Parameters:
resource – Test executor to be added.
uid – Optional input resource uid. We now force its equality with resource’s own uid.
- Returns:
Resource uid assigned.
- auto_part(tasks: List[Task]) List[Task][source]
Automatically partitions tasks into smaller parts based on runtime limits. This method takes a list of tasks and partitions them into smaller tasks if their runtime exceeds the configured auto_part_runtime_limit. The partitioning is determined by analyzing runtime data and calculating appropriate parts and weights for each task.
If the auto_part_runtime_limit is set to “auto”, the method derives the runtime limit based on historical runtime data or defaults to a predefined maximum value if no runtime data is available.
- calculate_pool_size() None[source]
Calculate the right size of the pool based on the weight (runtime) of the tasks, so that runtime of all tasks meets the plan_runtime_target.
- calculate_pool_size_by_tasks(tasks: Collection[Task]) int[source]
Calculate the right size of the pool based on the weight (runtime) of the tasks, so that runtime of all tasks meets the plan_runtime_target.
- discard_pending_tasks(exec_selector: Expr, report_status: Status = Status.INCOMPLETE, report_reason: str = '')[source]
- discover(path: str = '.', name_pattern: str | Pattern = '.*\\.py$') List[Task][source]
Discover task targets under path in the modules that matches name pattern, and return the created Task object.
- Parameters:
path – the root path to start a recursive walk and discover, default is current directory.
name_pattern – a regex pattern to match the file name.
- Returns:
A list of Task objects
- property exporters
Return a list of
report exporters.
- get_default_exporters()[source]
Instantiate certain exporters if related cmdline argument (e.g. –pdf) or programmatic arguments (e.g. pdf_path) is passed but there are not any exporter declarations.
- property report: TestReport
Tests report.
- schedule(task: Task | None = None, resource: str | None = None, **options) str | None[source]
Schedules a serializable
Taskin a task runnerPoolexecutor resource.- Parameters:
task (
Task) – Input task, if it is None, a new Task will be constructed using the options parameter.resource (
strorNoneType) – Name of the target executor, which is usually a Pool, default value None indicates using local executor.options (
dict) – Task input options.
- Return uid:
Assigned uid for task.
- Return type:
strorNoneType
- schedule_all(path: str = '.', name_pattern: str | Pattern = '.*\\.py$', resource: str | None = None)[source]
Discover task targets under path in the modules that matches name pattern, create task objects from them and schedule them to resource (usually pool) for execution.
- Parameters:
path (
str) – the root path to start a recursive walk and discover, default is current directory.name_pattern (
str) – a regex pattern to match the file name.resource (
strorNoneType) – Name of the target executor, which is usually a Pool, default value None indicates using local executor.
- class testplan.runnable.base.TestRunnerConfig(**options)[source]
Bases:
RunnableConfigConfiguration object for
TestRunnerrunnable object.- ignore_extra_keys = True
- class testplan.runnable.base.TestRunnerResult[source]
Bases:
RunnableResultResult object of a
TestRunnerrunnable object.- property success
Run was successful.
- class testplan.runnable.base.TestRunnerStatus[source]
Bases:
RunnableStatusStatus of a
TestRunnerrunnable object.
- testplan.runnable.base.check_local_server(browse)[source]
Early exit if local server (interactive extra) is not installed when user asks for displaying report using local server feature.
- testplan.runnable.base.collate_for_merging(es: List[TestGroupReport | TestCaseReport]) List[List[TestGroupReport | TestCaseReport]][source]
Group report entries into buckets, where synthesized ones in the same bucket containing the previous non-synthesized one.
- testplan.runnable.base.get_exporters(values)[source]
Validation function for exporter declarations.
- Parameters:
values – Single or a list of exporter declaration(s).
- Returns:
List of initialized exporter objects.