Skip to content

LucasZamprogno/AutoAssert

Repository files navigation

AutoAssert

A short demo video can be found here: https://www.youtube.com/watch?v=w1MoeZxfJko

Thesis abstract

Test cases use assertions to check program behaviour. While these assertions may not be complex, they are themselves code and must be written correctly in order to distinguish between passing and failing test cases. I assert that test assertions are relatively repetitive and straight-forward, making their construction well suited to automation; and that tools can reduce developer effort (and simultaneously improve the quality of the assertions in their test suites) by automatically generating assertions that the tester can choose to accept, modify, delete, or augment.

Such a tool can fit into a developer workflow where tests are frequently written alongside runnable source code. I examined 33,873 assertions from 105 projects and identified twelve high-level categories that account for the vast majority of developer-written test assertions, confirming that test assertions are fairly simple in practice. To assess the utility of my human-in-the-loop assertion generation thesis, I developed the AutoAssert framework, which generates typical assertions for test cases written for JavaScript code. AutoAssert uses dynamic analysis to determine both which assertions to generate and what values they should verify. The developer can choose to accept, modify, delete, or add to the set of generated assertions. I compared assertions generated by AutoAssert to those written by developers and found that it generates the same kind of assertions as written by developers 84% of the time in a sample of over 1,000 assertions. Additionally I validated the utility of AutoAssert-generated assertions with 17 developers; these developers found that the majority of generated assertions were useful and expressed considerable interest in using such a tool/approach for their own projects.

Notes and thoughts

This became a catch-all repo for most of the programming work for my thesis (PDF todo once formally published). It's a bit of a mess as plugin, static and dynamic analyses all shared parts (while not being conceived at the same time), needs a lot of cleanup. The online components are in a separate repo. Despite a necessarily hacky backend the plugin works, though still has some side effects and isn't deployment ready. It was intended as a prototype and that is where it currently sits.

About

For Masters thesis on assertion generation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published