scapy.contrib.automotive.scanner.staged_test_case
- class scapy.contrib.automotive.scanner.staged_test_case.StagedAutomotiveTestCase(test_cases: List[AutomotiveTestCaseABC], connectors: List[Callable[[AutomotiveTestCaseABC, AutomotiveTestCaseABC], Dict[str, Any]] | None] | None = None)[源代码]
基类:
AutomotiveTestCaseABC
,TestCaseGenerator
,StateGenerator
Helper object to build a pipeline of TestCases. This allows to combine TestCases and to execute them after each other. Custom connector functions can be used to exchange and manipulate the configuration of a subsequent TestCase.
- 参数:
test_cases -- A list of objects following the AutomotiveTestCaseABC interface
connectors -- A list of connector functions. A connector function takes two TestCase objects and returns a dictionary which is provided to the second TestCase as kwargs of the execute function.
示例
>>> class MyTestCase2(AutomotiveTestCaseABC): >>> pass >>> >>> class MyTestCase1(AutomotiveTestCaseABC): >>> pass >>> >>> def connector(testcase1, testcase2): >>> scan_range = len(testcase1.results) >>> return {"verbose": True, "scan_range": scan_range} >>> >>> tc1 = MyTestCase1() >>> tc2 = MyTestCase2() >>> pipeline = StagedAutomotiveTestCase([tc1, tc2], [None, connector])
- property completed: bool
- property current_connector: Callable[[AutomotiveTestCaseABC, AutomotiveTestCaseABC], Dict[str, Any]] | None
- property current_test_case: AutomotiveTestCaseABC
- execute(socket: SuperSocket | SingleConversationSocket, state: EcuState, **kwargs: Any) None [源代码]
- get_generated_test_case() AutomotiveTestCaseABC | None [源代码]
- get_new_edge(socket: _SocketUnion, config: AutomotiveTestCaseExecutorConfiguration) _Edge | None [源代码]
- post_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration # noqa: E501) None [源代码]
- pre_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration # noqa: E501) None [源代码]
- property previous_test_case: AutomotiveTestCaseABC | None
- property supported_responses: List[EcuResponse]
- property test_cases: List[AutomotiveTestCaseABC]