# colcon test: No test output files found in 'build/my_package/test_results'

- **ID:** `ros2/colcon-test-missing-test-output`
- **Domain:** ros2
- **Category:** test_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The test runner (e.g., pytest, gtest) did not produce output files in the expected directory because tests failed to run, were skipped, or the CMake/ament test configuration did not set up output generation correctly.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ROS2 Humble | active | — | — |
| ROS2 Iron | active | — | — |
| ROS2 Rolling | active | — | — |

## Workarounds

1. **Check if the test executable exists and can run: 'colcon test --packages-select my_package' and look for error messages in the console output. If tests are C++ gtest, ensure 'add_rostest' or 'ament_add_gtest' is used in CMakeLists.txt.** (85% success)
   ```
   Check if the test executable exists and can run: 'colcon test --packages-select my_package' and look for error messages in the console output. If tests are C++ gtest, ensure 'add_rostest' or 'ament_add_gtest' is used in CMakeLists.txt.
   ```
2. **Rebuild the package with '--cmake-args -DBUILD_TESTING=ON' and then run tests again. This ensures test targets are built.** (90% success)
   ```
   Rebuild the package with '--cmake-args -DBUILD_TESTING=ON' and then run tests again. This ensures test targets are built.
   ```
3. **For Python packages, ensure 'setup.py' or 'setup.cfg' has a 'test' section pointing to the correct test directory, and run 'colcon test' from the workspace root.** (80% success)
   ```
   For Python packages, ensure 'setup.py' or 'setup.cfg' has a 'test' section pointing to the correct test directory, and run 'colcon test' from the workspace root.
   ```

## Dead Ends

- **Running 'colcon test' with '--event-handlers console_direct+' to see all output, but still no test results** — This only increases verbosity; it does not fix the underlying issue of tests not producing output files. (80% fail)
- **Manually creating the test_results directory to satisfy colcon** — The directory must contain actual test output files; an empty directory does not resolve the error. (95% fail)
