The Unit Tests Strike Back: Testing the Hard Parts – Dave Steffen – CppCon 2021

https://cppcon.org/
https://github.com/CppCon/CppCon2020
---
Unit tests are now considered to be one of the foundational practices in modern software development. There are excellent talks and resources for getting started, and no end of good advice on how to write unit tests and what ideal tests should look like. Unit tests should be correct, complete, readable, resilient, and so forth.

But in real life, it's rarely possible to meet all these goals at the same time, and some situations make writing unit tests difficult or impossible. Existing or legacy code may not have been written with testing in mind; or "correct" results may not be well defined; or the code under test may rely on external services of hardware.

This talk reviews some of the most common "Plan B" techniques for tackling the more challenging unit testing situations. Topics covered will include

* White box testing: how to white box, when to white box test, and how to recover afterwards
* Abstract classes don't exist but we have to test them anyway.
* You can't test it without refactoring it, but you can't refactor without tests: cutting the legacy code gordian knot.
* It's probably right but we can't prove it, now what?
* It just failed: was it the code, the test, or some other part of reality?

Most techniques will first throw away some of the good advice we already have.

---
Dave Steffen

Dave Steffen completed his Ph.D. in theoretical physics at Colorado State University in 2003, and promptly changed course for a career in software engineering. He has worked primarily in defence and aerospace, and is currently a technical lead at SciTec Inc.'s Boulder office. For reasons unknown, he has turned out to be the expert, champion, and occasional street-corner evangelist for unit testing at most of the companies he has ever worked at.

---
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com

YouTube Channel Managed by Digital Medium Ltd https://events.digital-medium.co.uk

The CppCon YouTube Channel Is Sponsored By:
JetBrains : http://jb.gg/cpptools
SonarSource: https://www.sonarsource.com/

Filed under: Science & Technology

No comment yet, add your voice below!


Add a Comment