Code and Change Review Assistance for Unit and Component Testing: Citation Sources and Traceability

This category of data primarily comes from unit and component test scripts in code repositories, coverage reports generated by testing frameworks

What this category of data looks like

This category of data primarily comes from unit and component test scripts in code repositories, coverage reports generated by testing frameworks, Mock dependency documentation, and interface definition documents linked to requirements. The update frequency is daily or after each code commit. Daily associated documents include test cases, coverage statistics results, Mock configuration instructions, and defect tracking tickets. Each piece of data contains fields such as test case identifier, corresponding code module path, execution result, and linked requirement number, with no additional preset statistical indicators.

Data sources are scattered and updated frequently. The traceability link must support metadata association across multiple document types, while adapting to real-time synchronization triggered daily or after each code commit. Daily documents have diverse structures, including scripts, reports, instruction tickets and other formats. The traceability system must identify exclusive fields for different documents, such as test case identifiers and coverage metrics. Data is directly bound to specific code modules. Traceability results must accurately point to corresponding code units and test execution records, rather than making generalized associations. Otherwise, the system cannot support locating test gaps or defect root causes.

How to configure

This document is written based on FastGPT v4.17.0.

Configuration ItemRecommended ApproachRationale
quoteMaxToken2000–4000 tokenAdapt to the single-item content length of unit and component test documents, avoiding truncation of critical test case or coverage data
Number of recall resultsTop 3–5Match the association density between this category of data and code modules, avoiding excessive irrelevant test records interfering with traceability
responseDataEnable complete source fieldsExtract and display metadata from test documents, helping quickly locate corresponding test scripts or reports
Data synchronization trigger timingTriggered by commitMatch the rhythm of daily data updates or commit-based updates, ensuring real-time performance of traceability data
Recall similarity threshold0.7–0.8Match the semantic similarity distribution of test documents, accurately recalling test data for corresponding code units
detailEnable detailed traceability modeAccurately recall test data for corresponding code units, avoiding generalized associations
Context window sizeCalibrated based on actual testingAdapt to test document collections of different sizes, avoiding context overflow affecting recall accuracy

Three common misconfigurations

  • Symptom: The AI response does not display any citation sources, or the cited content is truncated. Cause: quoteMaxToken is set too small, or the responseData configuration is not enabled, resulting in failure to extract and display source information from test documents.
  • Symptom: The target test case or coverage report does not appear in the recall results. Cause: The recall similarity threshold is not set to match the current semantic distribution of test documents, leading to insufficient matching accuracy.
  • Symptom: Traceability results point to irrelevant code modules or old test data. Cause: The data synchronization trigger timing is not set to commit-triggered, resulting in old test data being mixed into the traceability results for current code changes.

How to confirm the configuration is correct

  • Submit a test code change, trigger FastGPT knowledge base synchronization, and check the synchronization log to confirm that documents such as test cases and coverage reports have been successfully indexed.
  • Input test-related questions for the corresponding code module, check the citation source list in the AI response, and verify whether the identifiers and paths of the target test documents are included.
  • Adjust quoteMaxToken or the recall similarity threshold, re-initiate a test query, and compare the quantity and relevance of recall results before and after to confirm that the configuration has taken effect.
  • After enabling the detail configuration, check the traceability details in the AI response to confirm that each citation source includes complete code paths and test case identifiers.

The values provided are common starting points and should be measured against the reader's own samples.

Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-10-19.