Future of Testing with C++20

By Kris Jusiak

Testing in C++ is not easy, it requires a lot of boilerplate code, macro usage and/or understanding of complicated testing frameworks. But it doesn’t have to be like that. C++20 will enable us to reinvent the way we write tests. If taking a glance into the future of testing in C++ peaks your interest this session is for you.

In this case study we will address the difficulty of testing with C++ by implementing a new, fully functional, macro-free testing framework [1] from scratch with modern C++20 features.

The main goal will be to leverage modern C++ in order to make the following snippet compile and run:

  1. int main() {

  2. "hello world"_test = [] { // Running "hello world"…​

  3. expect(12_i == fib(7)); // hello_world.cpp:3:FAILED [ 12 == 13 ]

  4. }; // tests: 1 | 1 failed

  5. } // asserts: 1 | 0 passed | 1 failed

The session will also focus on how to design modern testing facilities such as:

  • Sub/sections

  • Parameterized tests

  • Behaviour Driven Development (BDD)

At the end of this session the audience will have a better understanding of C++20 features such as:

  • New additions to lambdas

  • User Defined Literals (UDL)

  • Concepts

  • Source Location

As well as how and where to apply them. Additionally, attendees will get familiar with a new, expressive way of testing with modern C++.

Let’s get ready to test all the things at ACCU 2020 and follow the Beyonce rule - "If you liked it then you should put a test on it".





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.