HomeTesting & Validation
Development
Testing & Validation
测试与验证
All modifications to localization modules must pass the following test levels before merging into the main branch.
Test Levels
| Level | Framework | Content | Command |
|---|---|---|---|
Unit Test | gtest | Algorithm mathematical correctness, boundary conditions, parameter validation | ament_add_ros_isolated_gtest |
Smoke Test | autoware_testing | Node starts and exits normally with default parameters | add_smoke_test |
Integration Test | launch_testing | Simulate input data streams, verify output | pytest.mark.launch_test |
Rosbag Replay | Manual/CI | Real scenario data validation | ros2 bag play |
Rosbag Replay Metrics
| Metric | Description | Pass Criteria |
|---|---|---|
NDT Score (NVTL) | Matching quality | Should not significantly drop below baseline |
NDT Iteration Count | Convergence speed | Should not frequently reach max_iterations |
EKF Pose Gate Rejection Rate | Outlier ratio | < 5% |
Execution Time | Real-time performance | < critical_upper_bound_exe_time_ms |
Lateral Error RMSE | Localization accuracy | Port docking scenario < 5cm |
Longitudinal Error RMSE | Localization accuracy | Port docking scenario < 10cm |
Heading Error RMSE | Orientation accuracy | < 0.5° |
CI/CD Checks
| Check | Description |
|---|---|
DCO | Developer Certificate of Origin signature |
semantic-pull-request | PR title follows Conventional Commits |
pre-commit | Code formatting and lint checks |
spell-check-differential | CSpell spell checking |
build-and-test-differential | Build and test affected packages |
test_my_localizer.cpp
cpp
#include <gtest/gtest.h>
#include "autoware/my_localizer/algorithm.hpp"
TEST(AlgorithmTest, ScoreCalculation)
{
auto result = autoware::my_localizer::calculate_score(
test_cloud, test_map);
EXPECT_GT(result.score, 0.0);
EXPECT_LT(result.score, 100.0);
}
TEST(AlgorithmTest, EmptyInput)
{
auto result = autoware::my_localizer::calculate_score(
{}, test_map);
EXPECT_FALSE(result.is_valid);
}