Fundamentals 12 min read

Mock + Proxy: Automated Testing Practices for SDK Projects

This article describes the challenges of mock framework selection, the adoption of AnyProxy, and the design of reliable test cases using orthogonal array and pairwise testing, culminating in a detailed workflow for automated test case generation with the PICT tool and custom extensions.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Mock + Proxy: Automated Testing Practices for SDK Projects

To turn testing ideas into practice, the team identified several technical hurdles, starting with the selection of a mock framework. After evaluating options, they chose the open‑source AnyProxy because it is code‑open, rule‑customizable, HTTPS‑visual, easy to deploy, and provides a UI similar to Fiddler.

The next challenge was designing reliable test cases. Since the SDK mainly consists of single‑interface calls, the team focused on single‑interface test design, aiming to cover all field values while avoiding the combinatorial explosion of full Cartesian products. They introduced two algorithms: Orthogonal Array Testing Strategy (OATS) and Pairwise (All‑Pairs) testing, explaining their key properties and showing how they reduce test count while maintaining coverage.

Examples such as a flight‑booking scenario illustrate how pairwise testing extracts a minimal yet effective set of cases from an 18‑combination space, cutting the number of cases by about 50%.

After comparing several pairwise tools, the team selected Microsoft’s PICT for its open source nature, active maintenance, rich syntax, and greedy algorithm that yields locally optimal solutions.

The test‑case generation workflow is broken into five steps: (1) preparing field values, (2) building a PICT model file, (3) generating cases, (4) preparing expected results (including positive and negative testing), and (5) generating mock response data. Sample model files and generated case tables are shown.

During tool usage, limitations were found: PICT’s negative testing only allows a single abnormal value per case, and its LIKE constraint supports only simple wildcards. The team extended PICT’s source code to support multiple abnormal values and integrated C++ regex for richer constraints, demonstrating the enhanced capability with updated model files and case outputs.

Overall, the article provides a comprehensive guide to mock‑proxy testing, systematic test‑case design, and tool customization for SDK automation.

proxytest case generationMock Testingorthogonal arraypairwise testingPICT
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

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.