CppCon 2019 has ended
Back To Schedule
Thursday, September 19 • 14:00 - 15:00
Next generation unit testing using static reflection

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Unit testing is a widely accepted practice in the software engineering industry, which has been demonstrated to help reduce bugs in production and provide faster iteration cycles for development, helping with development trends such as agile development or continuous deployment.

While being part of the core of modern development, C++ due to its current language limitations lacks a unit testing framework that's expressive and concise enough to keep developers focused around tests themselves and not around all the code needed to support the tests. Current unit testing solutions for C++ usually require arcane constructions through macros, intrusive changes in the tested codebase in the form of class hierarchies for easy mocking, and in some cases manual test registration.

I present unittest, a proof of concept unit testing framework for C++14 based on Python's standard unittest package. unittest avoids the problems described above by using static reflection to figure out what code describes a unit test, and what library functions should be mocked as part of the test. Current C++14 implementation is based on tinyrefl, a libclang based static reflection tool, but the same concept will be possible to implement through future C++ reflection features like those proposed by the Reflection Technical Specification.

avatar for Manu Sánchez

Manu Sánchez

Software Engineer, By Access Control Systems
Manuel Sanchez started playing with modern C++ during his first year at the university, evolving into a template metaprogramming nerd and so-called C++ "expert". In September 2014 Manuel joined the Spanish startup biicode as a C++ consultant, helping the main developers packaging... Read More →

Thursday September 19, 2019 14:00 - 15:00 MDT
Crest 4/5
  • Software Evolution/Testing