New Module: Bond - A Spy-Based Testing and Mocking Library

erikkrogen at gmail.com erikkrogen at gmail.com
Thu Feb 25 13:04:48 EST 2016


Hi all -

As part of my work as a Computer Science Masters student at UC Berkeley I've been working with Prof. George Necula to develop a new testing library, called Bond, which introduces a new style of test assertions that we refer to as spy-based testing. Essentially, rather than explicitly coding all assertions about your test data, you allow the library to take observations of your state/variables/objects at specified "spy" points, and you can simply approve these observations when your code runs correctly to have them saved as reference observations for future runs of the test. This saves time when initially writing tests, but really shines when updating tests to new behavior, as we have an interactive flow that allows you to quickly reconcile differences in new behavior and old behavior (often without changing any code at all). There is a blog post with much more detailed information and examples available here: http://dreaming-neptune.blogspot.com/2016/02/bond-spy-based-testing-and-mocking.html, and the package is available on PyPI here: https://pypi.python.org/pypi/bond/ (you can `pip install bond` to install). Work on the library is ongoing so any feedback here or as comments on the blog would be much appreciated!

Thanks and enjoy!
Erik


More information about the Python-list mailing list