generated from wessel/boilerplate
2.3 KiB
2.3 KiB
RetakeGradeDeterminator Node Unit Tests
This document describes the unit tests for the RetakeGradeDeterminator ROS 2 node, as implemented in RetakeGradeDeterminator.test.cpp.
Test Cases
1. ConstructorTest
- Purpose:
Verifies that the
RetakeGradeDeterminatorcan be constructed without throwing exceptions. - Checks:
- The node is created successfully and is not
nullptr.
- The node is created successfully and is not
2. PublisherCreationTest
- Purpose:
Ensures that the node creates a publisher for the
student_course_managementtopic. - Checks:
- The
/student_course_managementtopic is present and uses theStudentmessage type.
- The
3. SubscriberCreationTest
- Purpose:
Ensures that the node subscribes to the
exam_resultstopic. - Checks:
- The
/exam_resultstopic is present and uses theExammessage type.
- The
4. ActionServerCreationTest
- Purpose:
Verifies that the node creates an action server for the
retake_action. - Checks:
- The action server is available and can be connected to by an action client.
5. ServiceClientCreationTest
- Purpose:
Ensures that the node creates a client for the
grade_calculator_service. - Checks:
- The
/grade_calculator_serviceis present in the node's service graph.
- The
6. ParameterTest
- Purpose: Confirms that the node's parameters are set to their expected default values.
- Checks:
- The
grade_collection_amountparameter defaults to5.
- The
7. ExamResultsIgnoredWhenRetakeNotAllowed
- Purpose: Ensures that exam results are ignored if a retake is not currently allowed.
- Checks:
- No service requests are made when a retake is not in progress.
8. RetakeActionGoalAcceptance
- Purpose: Verifies that the node accepts retake action goals and publishes the appropriate student enrollment message.
- Checks:
- The retake goal is accepted.
- A
Studentmessage is published with the correct student and course names.
9. PartialExamResultsCollection
- Purpose: Ensures that the node does not process or store results if not enough exam results have been collected during a retake.
- Checks:
- No service requests are made.
- No results are stored in the database if the required number of exam results has not been reached.