unreal.PythonTestRunner¶
- class unreal.PythonTestRunner(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
ObjectPython automation test runner.
C++ Source:
Plugin: ToolsetRegistry
Module: ToolsetRegistry
File: PythonTestRunner.h
- classmethod create(base_name, search_options, timeout_in_seconds=5.000000) PythonTestRunner¶
Create a test runner. code{.py}: import unreal from foo.bar import tests # It is important to reference the runner in a global to prevent it from being garbage # collected when instanced from an init_unreal.py script. tests._test_runner = unreal.PythonTestRunner.create( ‘MyPackage.Magic’, unreal.PythonTestRunnerSearchOptions(root_module=tests.__package__)) endcode:
- Parameters:
base_name (str) – Base name of the test case (e.g My.Tests) which will be prefixed to all Python test case names in test automation view.
search_options (PythonTestRunnerSearchOptions) – Options used to discover Python test cases.
timeout_in_seconds (float) – Time to wait for each test case to execute.
- Returns:
Instance of this object that holds a reference to a FPythonAutomationTest. This is intended to be used from Python to register a set of Python unittest tests with the Unreal test runner. For example, the following when called from a plugin’s init_unreal.py script, will register tests under the package foo.bar.tests as tests underneath MyPackage.Magic:
- Return type:
- get_last_test_result(test_id) PythonTestRunnerResult¶
Get the result of a test.
- Parameters:
test_id (str) – Python test ID to query.
- Returns:
Last result of the test.
- Return type: