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)[source]

Bases: 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.

Parameters:
  • 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.

Example

>>> 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[source]
get_generated_test_case() AutomotiveTestCaseABC | None[source]
get_new_edge(socket: _SocketUnion, config: AutomotiveTestCaseExecutorConfiguration) _Edge | None[source]
get_transition_function(socket: _SocketUnion, edge: _Edge) _TransitionTuple | None[source]
has_completed(state: EcuState) bool[source]
post_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration  # noqa: E501) None[source]
pre_execute(socket: _SocketUnion, state: EcuState, global_configuration: AutomotiveTestCaseExecutorConfiguration  # noqa: E501) None[source]
property previous_test_case: AutomotiveTestCaseABC | None
runtime_estimation() Tuple[int, int, float] | None[source]
show(dump: bool = False, filtered: bool = True, verbose: bool = False) str | None[source]
property supported_responses: List[EcuResponse]
property test_cases: List[AutomotiveTestCaseABC]