CppCon 2018: Phil Nash “Modern C++ Testing with Catch2”

preview_player
Показать описание


Catch has gained popularity over the last seven years as a modern, C++-native, test framework. Simple to use, easy to get started with, yet still powerful. With features like expression-template-based assertions, hierarchical sections (giving a more natural flow than set-up/ tear-down methods) and more, a lot of users say it makes testing easier and even fun!

Until recently, though, it has been constrained by pre-C++11 compatibility.
Catch2 rebases on C++11 and takes advantage of this to simplify further, as well as offer new capabilities.
This talk takes a look at what's new in Catch and Catch2 and how to effectively test-drive modern C++ codebases.

Familiarity with the original Catch is not assumed, but if you already use it, or have seen previous talks, in this material we'll focus more on some of the newer features.

Phil Nash, JetBrains
Developer Advocate

Phil is the author of the test frameworks, Catch - for C++ and Objective-C, and Swordfish for Swift. As Developer Advocate at JetBrains he's involved with CLion, AppCode and ReSharper C++. More generally he's an advocate for good testing practices, TDD and using the type system and functional techniques to reduce complexity and increase correctness. He's previously worked in Finance and Mobile as well as an independent consultant and coach specialising in TDD on iOS.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

Nice! Catch is such an easy to use test framework.

loomismeister
Автор

When he opens CLion, his machine enters rocket launching mode. Fortunately, he had enough memory

broken_abi
Автор

Wrt final discussion about replacing macro's: please don't. The macro's, besides addressing the technical issues, make for a nice DSL.
I use Catch/2 daily, thanks for making it!

FunkyBaby
Автор

So, uh, a correction: `random(-10000, 10000)` will generate 20k inputs, because what it actually does is to create the full range and then apply random permutation over it. In general, the current generators are not quite baked yet.

dragdu
Автор

I've been using old Catch. This talk makes me to imagine more test codes., ..!

luncliff
Автор

Is there an elegant way to pack tests with catch2 in the same project where all my original source code is? So that in CLion I would just have multiple configurations like "Run tests" and "Run project" (debug/release). What is the proper way?

StealerSlain