WithBehavior Class Template
Adds testing capabilities of Behaviors with context to any test fixture. More...
Declaration
class moveit_pro::test_utils::WithBehavior<BehaviorT> { ... }
Included Headers
Derived Classes
| class | WithActionBehavior<BehaviorT, ClientInterfaceT> |
Public Member Functions Index
template <class BehaviorT> | |
| void | initBehavior (const std::string &name, PortSetterMapGenerator input_port_setter_generator, PortSetterMapGenerator output_port_setter_generator) |
|
Initializes the Behavior under test. More... | |
template <class BehaviorT> | |
| BehaviorT & | behavior () |
template <class BehaviorT> | |
| BT::NodeConfiguration & | config () |
template <class BehaviorT> | |
| BT::Blackboard & | blackboard () |
template <class BehaviorT> | |
| MockLogger & | mockLogger () |
template <class BehaviorT> | |
| behaviors::BehaviorContext & | behaviorContext () |
template <class BehaviorT> | |
| auto | behaviorContextSharedPtr () -> std::shared_ptr< behaviors::BehaviorContext > |
template <class BehaviorT> | |
| rclcpp::Node & | behaviorNode () |
template <class BehaviorT> | |
| auto | behaviorNodePtr () -> std::shared_ptr< rclcpp::Node > |
template <class BehaviorT> | |
| void | setTestDataDirectories (const std::vector< std::string > &objective_library_directories) |
|
Configure the directories that a test will read data from and/or write data to. More... | |
template <class BehaviorT> | |
| void | setTransform (const geometry_msgs::msg::TransformStamped &transform_msg) |
|
Makes a transform available in the shared transform buffer. More... | |
template <class BehaviorT> | |
| void | setTransform (const builtin_interfaces::msg::Time &stamp, std::string_view parent_frame, std::string_view child_frame, const Eigen::Isometry3d &transform) |
|
Makes a transform available in the shared transform buffer. More... | |
template <class BehaviorT> | |
| void | initBehaviorCommon (const std::string &name, PortSetterMapGenerator input_port_setter_generator, PortSetterMapGenerator output_port_setter_generator) |
template <class BehaviorT> | |
| auto | behaviorPtr () -> std::unique_ptr< BehaviorT > & |
Private Member Functions Index
template <class BehaviorT> | |
| void | initBehaviorCommon (const std::string &name, PortSetterMapGenerator const input_port_setter_generator, PortSetterMapGenerator const output_port_setter_generator, bool tf2_spin_thread, bool load_robot_model) |
Private Member Attributes Index
template <class BehaviorT> | |
| std::unique_ptr< BehaviorT > | behavior_ |
template <class BehaviorT> | |
| BT::NodeConfiguration | config_ |
template <class BehaviorT> | |
| std::shared_ptr< behaviors::BehaviorContext > | shared_resources_ |
template <class BehaviorT> | |
| std::shared_ptr< rclcpp::Node > | node_ |
template <class BehaviorT> | |
| MockLogger * | mock_logger_ptr_ |
Description
Adds testing capabilities of Behaviors with context to any test fixture.
To test a Behavior with context (shared resources), a test fixture inherits from this class in addition to any base test fixture, e.g. ::testing::Test, ::moveit_pro::test_utils::RostTest, etc. The fixture automatically tests that the Behavior creates all and only the expected ports.
- Template Parameters
-
BehaviorT The class of the Behavior under test.
Definition at line 94 of file test_behavior.hpp.
Public Member Functions
behavior()
| inline |
Definition at line 108 of file test_behavior.hpp.
behaviorContext()
| inline |
Definition at line 124 of file test_behavior.hpp.
behaviorContextSharedPtr()
| inline |
Definition at line 128 of file test_behavior.hpp.
behaviorNode()
| inline |
Definition at line 132 of file test_behavior.hpp.
behaviorNodePtr()
| inline |
Definition at line 136 of file test_behavior.hpp.
behaviorPtr()
| inline |
Definition at line 167 of file test_behavior.hpp.
blackboard()
| inline |
Definition at line 116 of file test_behavior.hpp.
config()
| inline |
Definition at line 112 of file test_behavior.hpp.
initBehavior()
|
Initializes the Behavior under test.
Call this function in your fixture's constructor, SetUp() or any of its setUp* variations.
- Parameters
-
name The name of the Behavior.
input_port_setter_generator A port setter map generator defining the expected input ports.
output_port_setter_generator A port setter map generator defining the expected output ports.
- Exceptions
-
<a href="/api/classes/moveit-pro/test-utils/wrongbehaviorportsexception">WrongBehaviorPortsException</a> if the Behavior does not define exactly the expected ports.
Declaration at line 105 of file test_behavior.hpp, definition at line 158 of file test_behavior_impl.hpp.
initBehaviorCommon()
|
Declaration at line 165 of file test_behavior.hpp, definition at line 141 of file test_behavior_impl.hpp.
mockLogger()
| inline |
Definition at line 120 of file test_behavior.hpp.
setTestDataDirectories()
|
Configure the directories that a test will read data from and/or write data to.
- Parameters
-
objective_library_directories Directories where the test should search for data and/or write data to.
Declaration at line 145 of file test_behavior.hpp, definition at line 178 of file test_behavior_impl.hpp.
setTransform()
|
Makes a transform available in the shared transform buffer.
The Behavior will have access to the transform, as well as other Behaviors sharing the buffer.
- Parameters
-
transform_msg The stamped transform message.
Declaration at line 152 of file test_behavior.hpp, definition at line 184 of file test_behavior_impl.hpp.
setTransform()
|
Makes a transform available in the shared transform buffer.
The Behavior will have access to the transform, as well as other Behaviors sharing the buffer.
- Parameters
-
stamp Timestamp of the transform.
parent_frame Frame from which the transform is expressed.
child_frame Child frame described by the transform with respect to the parent frame.
transform Transform from the parent frame to the child frame.
Declaration at line 162 of file test_behavior.hpp, definition at line 190 of file test_behavior_impl.hpp.
Private Member Functions
initBehaviorCommon()
|
Definition at line 178 of file test_behavior.hpp.
Private Member Attributes
behavior_
|
Definition at line 173 of file test_behavior.hpp.
config_
|
Definition at line 174 of file test_behavior.hpp.
mock_logger_ptr_
|
Definition at line 177 of file test_behavior.hpp.
node_
|
Definition at line 176 of file test_behavior.hpp.
shared_resources_
|
Definition at line 175 of file test_behavior.hpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.