Backend Development 8 min read

Precise Backend Interface Testing via Code Diff Analysis and Traffic Recording

The platform listens to GitLab change events, parses Java, ObjC, and Flutter diffs to locate modified methods, maps those methods to entry HTTP/RPC interfaces using recorded traffic call chains, and automatically selects corresponding regression test cases, dramatically cutting testing effort while enabling future risk analysis.

Xianyu Technology
Xianyu Technology
Xianyu Technology
Precise Backend Interface Testing via Code Diff Analysis and Traffic Recording

Background: In server-side quality assurance, interface testing is crucial. Traditional methods rely on manual testing and full regression, lacking tools to pinpoint impact of code changes.

Solution Overview: The platform subscribes to GitLab events to obtain changed files and line ranges, analyzes code diffs to identify modified methods, maps these methods to entry HTTP/RPC interfaces using traffic recording, and links them to traffic test cases.

Key Steps:

step1: Subscribe to GitLab messages to get code change info.

step2: Analyze diffs to determine affected methods.

step3: Use the traffic recording platform to obtain call chains and map methods to entry interfaces.

step4: Retrieve corresponding traffic test cases.

step5: Establish mapping between changed methods and traffic cases.

Code Diff Analysis: Supports Java, ObjC, Flutter. For ObjC, the process extracts file paths and line ranges from Git diff, parses files line‑by‑line to build a lightweight AST‑like structure of method blocks, and matches changed line ranges to method definitions (e.g., method getName ).

Method Call Chain Extraction: Utilizes the traffic recording platform in pre‑release environments to capture method call chains for HTTP/RPC interfaces, then stores the mapping between methods and interfaces.

Traffic Recording: Records real traffic (both HTTP and RPC) from production or pre‑release, stores it in a database keyed by traffic ID, and links it to the corresponding interface.

Test Case Association: After identifying changed methods and their related interfaces, the system queries the stored traffic‑case mappings to select precise regression test cases, enabling targeted testing instead of full regression.

Effect and Outlook: Targeted regression reduces total testing time dramatically (from M·N·n·7 to K·N·n·7, where K < 1 min). The accumulated data also supports future risk assessment, quality prediction, and service monitoring.

backendcode analysisinterface testingRisk Assessmenttraffic recording
Xianyu Technology
Written by

Xianyu Technology

Official account of the Xianyu technology team

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.