Design and Implementation of Ctrip Hotel's Interface Comparison Platform
This article introduces Ctrip Hotel's automated comparison platform, detailing its motivation, overall architecture, and the four modules—interface, database, tracing, and cache comparison—along with configuration, execution methods, and results, highlighting its impact on testing efficiency and scalability.
1. Introduction
The team identified several pain points—similar .net-to-java responses, large test volumes, limited scenarios, need for automation, and monitoring—that motivated the development of an interface comparison platform.
2. Overall Architecture
The platform consists of four modules: interface comparison, database comparison, tracing (埋点) comparison, and cache comparison, each capable of independent operation or coordinated execution based on user configuration.
Key technologies include stream-based message parsing and distributed multithreaded execution, enabling node‑ignoring, sorting, selective comparison, large‑message handling, and faster processing.
3. Module Details
3.1 Interface Comparison
Compares responses from two service versions for the same request, supporting configurable rules such as case‑insensitivity, node ignoring, attribute ignoring, numeric comparison, whitelist, and node replacement. Test cases can be sourced from manual configuration, ES storage, or database pulls, and can be run via CI, manual triggers, timers, or single‑case execution in a distributed, multithreaded manner.
3.2 Database Comparison
Compares fields of corresponding orders across databases, with case sources from manual setup or generated by the interface module. Configuration includes target tables, ignored fields, and specific fields to compare. Execution can be manual or triggered after interface comparison, also using distributed multithreading.
3.3 Tracing Comparison
Generates tracing test cases from the interface module and compares trace data retrieved from Elasticsearch based on trace keys, with configuration of application ID and optional common rules. Execution is triggered by the interface module.
3.4 Cache Comparison
Compares data fetched from databases with data stored in cache, with manual case configuration specifying SQL queries, cache keys, and fields to compare. It can run on a schedule or manually.
4. Summary
After more than a year of stable operation, the platform handles over 500,000 cases, reduces testing time by more than 55%, automates failure analysis, and requires minimal maintenance, proving to be a critical component of the automated testing ecosystem.
Ctrip Technology
Official Ctrip Technology account, sharing and discussing growth.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.