Mimicking Production Behavior with Generated Mocks
Deepika Tiwari, Martin Monperrus, Benoit Baudry

TL;DR
This paper presents RICK, a tool that automatically generates realistic mock-based tests by monitoring production applications, improving test accuracy and regression detection.
Contribution
It introduces a novel approach to generate mocks from production data, enhancing test realism and effectiveness, implemented in an open-source tool called RICK.
Findings
52.4% of generated tests mimic production behavior
Mocks effectively detect regressions in target methods
Monitoring 128 methods across applications is feasible
Abstract
Mocking allows testing program units in isolation. A developer who writes tests with mocks faces two challenges: design realistic interactions between a unit and its environment; and understand the expected impact of these interactions on the behavior of the unit. In this paper, we propose to monitor an application in production to generate tests that mimic realistic execution scenarios through mocks. Our approach operates in three phases. First, we instrument a set of target methods for which we want to generate tests, as well as the methods that they invoke, which we refer to as mockable method calls. Second, in production, we collect data about the context in which target methods are invoked, as well as the parameters and the returned value for each mockable method call. Third, offline, we analyze the production data to generate test cases with realistic inputs and mock interactions.…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software Testing and Debugging Techniques · Software Reliability and Analysis Research
