====== Testing ======
===== Unit Tests =====
The primary goal of the unit tests are to expand the code coverage for subsystems, typically by mocking the variables necessary to test a single function.
===== Functional Tests =====
Functional tests are used to perform a more in-depth analysis of the degree of functionality for a specific subsystem. Many of the functional tests written for the submarine modules will focus on accuracy of measurements and readings. This will be extremely important in verifying the reliability of the SLAM system implemented on the submarine as new modules are transitioned from simulated testing to real-world.
===== In-water Tests =====
Real-world testing is often performed at Gibb pool, which allows for full systems testing with an in-water pinger.
===== Compiling and Running =====
==== Compile All Tests ====
To compile all tests, execute the following command from any directory:
$ rsmake tests
==== Run All Tests ====
To run all tests, execute the following command from any directory:
$ rsmake run_tests
==== Run One Test ====
To run a single test, execute the following command from any directory:
$ rostest robosub
By default, rostest creates a new master for all publishers and subscribers. If you wish to view messages being passed between nodes, simply add ''%%--%%reuse-master'' to the above command.
===== Tested Components =====
==== Localization ====
The localization system had an extensive testing suite implemented as part of the SLAM project. Localization is one of the fundamental systems relied upon by the SLAM system, so it's vital that this system performs up to expectations to ensure the maps generated are accurate and usable.
The general description of the localization system is that it takes data from the depth sensors and hydrophones to triangulate the position of the pinger in the water, then takes additional data from the IMU to help determine positioning changes in the water. An important aspect of the system is to maintain accuracy as the submarine's position changes, which is what several tests focus on. At the time of the tests' creation the physical submarine was inoperable, so many of the tests utilize the simulator to make changes to the submarine's position underwater.
One of the most useful findings uncovered by the tests written were inconsistencies in how the localization system recovered its position when the submarine 'jumped' underwater to a new position. The localization system, in theory, is supposed to check extraneous points outside the point cloud to ensure possible recovery in the event that it was taken suddenly off course. However, we found that the system failed to do so, and instead began an accelerated drift off the map from which it couldn't recover. This issue has been noted, and will be addressed by the club in future work.