Backend Development 14 min read

Automated Randomized Testing Framework for Kuaishou Advertising Landing Pages

This article describes a Selenium‑based automated testing solution that randomly assembles ad landing page components, captures before‑and‑after screenshots, and evaluates visual similarity using histogram and dHash algorithms to ensure "what you see is what you get" across thousands of component combinations.

Kuaishou Tech
Kuaishou Tech
Kuaishou Tech
Automated Randomized Testing Framework for Kuaishou Advertising Landing Pages

The Kuaishou Commercial Quality Group introduced an automated testing framework for advertising landing pages, aiming to guarantee the quality and precision of ad delivery across multiple business lines such as information flow ads, brand ads, and social ads.

Because the landing‑page builder offers dozens of components with numerous configurable attributes, exhaustive manual testing is infeasible; many component combinations can cause layout misalignment, component overlap, and degraded user experience.

The proposed solution uses Selenium to log into the landing‑page editor, randomly add components, assign random attribute values, and then capture screenshots of both the editor view (expected layout) and the preview view (actual layout). The two images are compared with a weighted combination of histogram similarity and dHash similarity; if the combined score falls below a threshold (0.9), the test round is marked as failed and detailed logs are stored for debugging.

The framework is organized into five modules: Logs (logging), DealAttribute (per‑component attribute handling), LandingPageComponent (main workflow), JsonParseClass (JSON configuration parsing), and Tools (utility functions such as UUID generation and image comparison). Component configurations are stored in JSON files, allowing easy updates without code changes.

Key technical details include:

Random component addition via RandomAddComponent() and attribute assignment through DealAttribute() .

Image similarity algorithms evaluated: mutual information (unsuitable for resized images), histogram similarity (captures color distribution), and perceptual hashing methods (aHash, pHash, dHash). The final similarity metric is S = x·S1 + y·S2 , where S1 is histogram similarity, S2 is dHash similarity, and x + y = 1 .

After more than 500 automated runs, the threshold of 0.9 reliably identified discrepancies, enabling the team to catch and remediate layout issues before they reach production, reducing manual testing effort by approximately one person‑day per week.

In conclusion, the random automated testing framework effectively fills the coverage gap left by manual testing, discovers hidden component compatibility problems, and improves both quality assurance and development efficiency for Kuaishou’s advertising landing‑page platform.

automated testinglanding pagequality assuranceimage similaritySeleniumrandomized testing
Kuaishou Tech
Written by

Kuaishou Tech

Official Kuaishou tech account, providing real-time updates on the latest Kuaishou technology practices.

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.