Open Access. Powered by Scholars. Published by Universities.®

Physical Sciences and Mathematics Commons

Open Access. Powered by Scholars. Published by Universities.®

Loyola University Chicago

2019

Software engineering

Articles 1 - 1 of 1

Full-Text Articles in Physical Sciences and Mathematics

Tests As Maintainable Assets Via Auto-Generated Spies: A Case Study Involving The Scala Collections Library's Iterator Trait, Konstantin Läufer, John O'Sullivan, George K. Thiruvathukal Jul 2019

Tests As Maintainable Assets Via Auto-Generated Spies: A Case Study Involving The Scala Collections Library's Iterator Trait, Konstantin Läufer, John O'Sullivan, George K. Thiruvathukal

Computer Science: Faculty Publications and Other Works

In testing stateful abstractions, it is often necessary to record interactions, such as method invocations, and express assertions over these interactions. Following the Test Spy design pattern, we can reify such interactions programmatically through additional mutable state. Alternatively, a mocking framework, such as Mockito, can automatically generate test spies that allow us to record the interactions and express our expectations in a declarative domain-specific language. According to our study of the test code for Scala’s Iterator trait, the latter approach can lead to a significant reduction of test code complexity in terms of metrics such as code size (in some …