HomeTesting & Validation
Development

Testing & Validation

测试与验证

All modifications to localization modules must pass the following test levels before merging into the main branch.

Test Levels

LevelFrameworkContentCommand
Unit TestgtestAlgorithm mathematical correctness, boundary conditions, parameter validationament_add_ros_isolated_gtest
Smoke Testautoware_testingNode starts and exits normally with default parametersadd_smoke_test
Integration Testlaunch_testingSimulate input data streams, verify outputpytest.mark.launch_test
Rosbag ReplayManual/CIReal scenario data validationros2 bag play

Rosbag Replay Metrics

MetricDescriptionPass Criteria
NDT Score (NVTL)Matching qualityShould not significantly drop below baseline
NDT Iteration CountConvergence speedShould not frequently reach max_iterations
EKF Pose Gate Rejection RateOutlier ratio< 5%
Execution TimeReal-time performance< critical_upper_bound_exe_time_ms
Lateral Error RMSELocalization accuracyPort docking scenario < 5cm
Longitudinal Error RMSELocalization accuracyPort docking scenario < 10cm
Heading Error RMSEOrientation accuracy< 0.5°

CI/CD Checks

CheckDescription
DCODeveloper Certificate of Origin signature
semantic-pull-requestPR title follows Conventional Commits
pre-commitCode formatting and lint checks
spell-check-differentialCSpell spell checking
build-and-test-differentialBuild 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);
}