Moles: Tool-Assisted Environment Isolation with Closures

Moles: Tool-Assisted Environment Isolation with Closures
复制标题

Moles:工具辅助的环境隔离与封闭

DOI:
--
复制
发表时间:
2010
期刊:
International Conference on Software Technology: Methods and Tools
影响因子:
--
通讯作者:
N. Tillmann
N. Tillmann
中科院分区:
--
文献类型:
--
作者:
J. D. Halleux;N. Tillmann

文献摘要

被引文献

相似文献

将测试用例从环境依赖中分离出来通常是可取的,因为它增加了测试可靠性并减少了测试执行时间。但是,调用非虚拟方法或使用密封类的代码通常无法单独测试。mole是一个新的轻量级框架,它解决了这个问题。对任何人来说。. NET方法,mole允许测试代码提供替代实现,如。. NET委托,c#在闭包对象中捕获局部变量时提供了非常简洁的语法。使用代码插装,mole框架会将调用重定向到提供的委托,而不是原始方法。mole框架被设计为与动态符号执行工具Pex一起工作,以实现自动化测试生成。在一个案例研究中,我们测试了针对Microsoft SharePoint Foundation API编写的代码,在没有实际SharePoint服务器的情况下,在独立运行测试时实现了完整的代码覆盖。mole框架集成了。. NET和Visual Studio。
Isolating test cases from environment dependencies is often desirable, as it increases test reliability and reduces test execution time. However, code that calls non-virtual methods or consumes sealed classes is often impossible to test in isolation. Moles is a new lightweight framework which addresses this problem. For any .NET method, Moles allows test-code to provide alternative implementations, given as .NET delegates, for which C# provides very concise syntax while capturing local variables in a closure object. Using code instrumentation, the Moles framework will redirect calls to provided delegates instead of the original methods. The Moles framework is designed to work together with the dynamic symbolic execution tool Pex to enable automated test generation. In a case study, testing code programmed against the Microsoft SharePoint Foundation API, we achieved full code coverage while running tests in isolation without an actual SharePoint server. The Moles framework integrates with .NET and Visual Studio.