Design and Implementation of a Traffic Replay Platform for Interface and UI Automation at Ctrip

This article describes how Ctrip built a traffic replay platform that leverages ElasticSearch logs to automate both API and UI testing, enabling rapid regression, visual comparison, and continuous integration, ultimately reducing test effort and increasing release frequency.

Ctrip Technology
Ctrip Technology
Ctrip Technology
Design and Implementation of a Traffic Replay Platform for Interface and UI Automation at Ctrip

When Ctrip’s product releases grew in complexity, manual regression testing became time‑consuming and slowed release cycles, prompting the development of a traffic replay platform that minimizes user intervention.

The platform extracts production logs from ElasticSearch, using its powerful query and aggregation capabilities to treat log entries as traffic data for testing.

Interface Automation is divided into three stages: (1) building request messages by normalizing ES records with tokens and business tags; (2) executing requests by replaying logged responses, supporting concurrent mock testing and dual‑environment comparison; and (3) analyzing results by aggregating responses, generating reports with diff highlighting, and linking to original logs. The process is integrated into CI, delivering analysis reports within about three minutes per commit.

To address the maintenance burden of growing business tags, the platform aggregates ES query results, presenting the most frequent tag combinations to users, reducing manual query composition.

Image Comparison Testing (UI Automation) replaces fragile element‑based scripts with a log‑driven approach: server‑side request/response pairs are mocked for the UI, results are shown as side‑by‑side screenshots, pixel‑level diff matrices are overlaid to highlight changes, and Puppeteer replaces Selenium for headless Chrome control. Additional features include OCR‑based text diff, modular screenshot slicing, and multi‑server concurrent execution.

Since deployment, the platform has executed over 50,000 runs, uncovered more than 3,000 issues (averaging 10 per day), and increased release frequency from once a week to three times a week, demonstrating significant efficiency gains while acknowledging that no tool can guarantee 100% quality.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Backendci/cdtraffic replaytest automation
Ctrip Technology
Written by

Ctrip Technology

Official Ctrip Technology account, sharing and discussing growth.

0 followers
Reader feedback

How this landed with the community

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.