Automated Precise Testing and Android Call‑Chain Construction for Mobile Applications
This article describes a workflow for automatically recommending precise test cases for each code change in Android MR pipelines by building and optimizing activity‑method call chains using static analysis, linking test cases to changed methods, and demonstrating significant efficiency gains in large‑scale mobile development.
Background – Precise automated testing aims to automatically and accurately test the code changes in each merge request (MR) to improve code quality and reduce manual testing effort.
Existing workflow – Traditional development involves developers performing white‑box self‑tests and QA engineers conducting black‑box tests, often recording test cases per Activity. Full‑run of all test cases for every MR is costly and unnecessary because many changes affect only a few methods.
Automated testing process – The manual execution of existing test cases is transformed into an automated CI step that fetches the APK, triggers cloud‑device testing via an internal cloud‑device platform, and runs the relevant test scripts.
Precise testing solution – The problem is to (1) associate test cases with code, (2) obtain the MR’s changed methods, and (3) recommend the most relevant test cases. The solution builds an Android call‑chain graph that links Activities to the methods they invoke, enabling the identification of affected Activities for a given code change.
Android call‑chain construction – Using static analysis (Soot) on the APK, the tool extracts all classes, methods, and method bodies, creates edges for method calls, and generates a global call graph. Activities are identified by inheritance from android.app.Activity or androidx.appcompat.app.AppCompatActivity , and activity‑centric sub‑graphs are derived.
Call‑chain optimization – To handle fragments, custom views, and layout‑inflated components, the approach models static and dynamic fragment loading, custom view insertion, and layout file references, manually adding edges for system override methods and mapping layout IDs to resources to connect these components back to their hosting Activities.
Benefits – After deployment to Douyin’s MR pipeline, the solution saved ~35% of testing effort, increased activity coverage by about 15× compared with generic automation, and uncovered an average of three crashes per MR.
Conclusion and outlook – The Android call‑chain technique can be extended to sensitive method tracing and API call analysis; future work includes handling asynchronous calls and generating finer‑grained basic‑block call chains for even more precise testing recommendations.
Team information – The Bytedance Client Infrastructure team, a global front‑end infrastructure group, is hiring for client, front‑end, back‑end, intelligent‑algorithm, and testing roles.
ByteDance Terminal Technology
Official account of ByteDance Terminal Technology, sharing technical insights and team updates.
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.