A test suite people actually run
You will: Prove the robot description is sound, in under a minute, with no simulator running.
Builds on Living inside the container.
The suite is budgeted. Not "we try to keep it fast" — budgeted, as a design constraint: 60 seconds. A suite that takes five minutes is a suite people stop running before they commit, and an unrun test is an expensive comment.
That budget shapes what goes in it. Anything needing a simulator lives in a different target, because physics is slow and non-deterministic and does not belong in the loop you run every few minutes.
It is worth noticing what can be tested at this stage. There is no robot, no hardware and no simulator — and there are still about nine hundred checks worth making:
- configuration — every mass says where its number came from, every name is legal, no dimension is zero or negative
- structure — one root, no orphan links, every frame later phases depend on is present
- physics plausibility — every inertia tensor is physically possible, total mass is in a sane range
- consistency — the limits in the generated model equal the limits in the source data, across a unit conversion
- architecture — a hardware build contains no simulator, and the package that runs on the robot cannot depend on one
Plus C++ tests for the servo bus protocol and the hardware interface, which you will meet in Tier 5, and the linters, which the summary counts too. Robotics has far more that can be checked cheaply than its reputation suggests.
Every test also runs against every hardware target, and against every robot profile in the repository: the SO-101's, and the profiles of the 3VN Arm 1, the arm this project was first built on, which the suite still checks. Add a profile and the matrix widens by itself.
In the simulation
One check in the suite is consistency: the limits in the generated model equal the limits in the source data, across a unit conversion. On the 3VN Arm 1's profiles that source is written in degrees; the SO-101's limits are upstream's, in radians, so do the conversion the other way: drive a joint to its limit and turn the radians the inspector prints into degrees.
Kinematic: joints move at their real speed limit, but there is no gravity, no load and no physics. That is what the steps below are for.
The SO-101 loads as you reach it.
In this lesson
- Open Inspect, on its /joint_states view.
- Drag
elbow_flexto its lower limit. Its position should read about −1.69 rad, which is −97°. - Drag
wrist_flexto its upper limit and read it, about 1.658 rad, +95°.
Joints · SO-101 follower
Limits from the description; speed capped at 1.7434 rad/s, the servo's datasheet derated. Poses from the profile.
Inspector
Code
The repository's own code behind what you do here appears once you move the arm.
Do it
Run the suite, and time it.
time make testExpect: A final
Summary:line with about 970 tests,0 errors, 0 failures, and about twenty skipped, in under a minute once the workspace is built. The skipped ones arecppcheck, which ROS will not run in the version this image has. If the SO-101's description has not been fetched, its tests skip too, each sayingmake so101-fetch.Read the one test that is the architecture. It is short.
less src/threevn_robot_description/test/test_ros2_control_targets.pyNow break something on purpose. In
src/threevn_robot_description/config/so101_follower.yaml, changemodel: so101_followertomodel: so-101_follower, spelled the way the product is, and run the suite again.make testExpect:
test_its_model_name_is_ros_legalfails with a message saying why. So do four others, and that is the second lesson: the profile-name check, and three description builds whose robot is now calledso-101_follower. The bad name has already spread into the generated URDF. The summary says6 failures: five tests, and the CTest entry that ran them.Read why the rule exists. A ROS name is lowercase letters, digits and underscores, and starts with a letter, because names become C++ namespaces, Python modules and CMake targets. YAML accepts
so-101_followerwithout complaint. The failure would come later, deep in the middleware, in an error that does not mention the name. The test moves that failure here, to the line that caused it. It is also why every package in this project is calledthreevn_…and never3vn_…. The profile keeps a separatedisplay_namefor people.grep -n -E "model:|display_name:" src/threevn_robot_description/config/so101_follower.yamlExpect:
model: so-101_follower, your planted fault, anddisplay_name: "SO-101 follower". The display name may contain a hyphen and a space, because nothing derives a ROS name from it.Put it back, and confirm green.
git checkout src/threevn_robot_description/config/so101_follower.yaml make test
When it goes wrong
make test suddenly takes minutes instead of seconds.
Why: Something slow reached the fast suite. In ament_cmake packages, pytest is launched by CTest, which never sees colcon's --pytest-args -m "not slow" — so a marker alone does not keep a simulator test out.
Fix: Slow tests are registered explicitly rather than filtered by marker. Tier 4 covers how; make test-sim runs them.
A failure you have already fixed keeps being reported.
Why: colcon test-result reports every result file under build/, not only this run's.
Fix: make test clears old results first. If you run colcon by hand, delete build/*/test_results before testing.
A name works in YAML and fails later inside the middleware, with an error that does not mention the name.
Why: A ROS identifier starting with a digit. YAML does not care; DDS entity names do.
Fix: Keep a ROS-legal identifier and a separate display name, and assert the identifier matches [a-z][a-z0-9_]* in a test.
Terms
- REP-144
- The ROS convention for package names: lowercase letters, digits and underscores, starting with a letter.
- Test budget
- A hard limit on how long the fast suite may take — here 60 seconds — treated as a design constraint, because speed is what makes people run it.
- Test matrix
- The same tests parametrised over every robot profile and every hardware target, so adding either widens coverage automatically.
Every term in the course: glossary.
Check yourself
Answer in your head first, then open it.
Why is the 60-second budget a design constraint rather than an aspiration?
Because the value of a test is that it runs. A slow suite gets skipped before commits, and a skipped test protects nothing. The budget decides what may enter the suite, rather than being hoped for afterwards.
There is no robot, no hardware and no simulator yet. Name three things that can still be checked.
Any three of: config schema and provenance, legal names, tree structure and required frames, inertia validity, total mass plausibility, limits matching the source data, the hardware seam, and package dependency direction.
Stretch
Pick any one assertion in src/threevn_robot_description/test/test_inertia_valid.py and write a sentence describing what would happen in Gazebo if the condition it checks were false. Then decide: would you have found that bug faster in the simulator, or with this test?
Hint
An invalid inertia does not raise an error when the model loads. It produces NaN on first contact, which looks like an unstable simulator.