This course is for software developers and students who want to be better programmers by writing more solid, bug-free code using the Google Test framework.
Your code will get better and you will have more confidence that your code is correct, because you will catch more bugs using automated tests.
How many times did this happen to you? You wrote new code, and after your hard work is done, you find that you broke features that used to work? And you had to waste more hours finding and fixing the bugs... This problem can get solved in most cases by using automated tests, especially unit tests.
No experience with automated testing is required. Very basic C++ knowledge is needed, nothing too sophisticated.
If you are completely new to Google Test, this course is just for you! If you already have some knowledge, look at the course content and see if you find some more advanced features that you didn't know about.
Google Test works on multiple platforms. You can use any platform you like. In this course, I am doing it on:
Windows (Visual Studio)
Linux (CMake or compiling directly from the command line)
Other platforms will be added if you suggest them to me
There are slides and hands-on coding examples in each section. I recommend that you try the examples and play around with them.
Here's a brief presentation of the course content:
Optional videos: Setting up on Windows (Visual Studio) and on Linux (CMake and GCC)
Basics of unit testing:
Unit test structure
Assertions - numeric, string, exceptions
Reusing code between tests (test fixtures, SetUp() and TearDown())
Parameterized tests: generate multiple tests by writing one single function.
Mocking - replacing real objects with fakes that you can control):
Setting the behaviour of mocks
Who this course is for:
Software developers and students who want to make their code more robust, bug-free
Anyone interested in Google Test and Google Mock
8 sections • 54 lectures • 3h 7m total length
Installing Visual Studio
Visual Studio - Sample GTest Project
Installing on Linux
Google Test CMake Sample (Linux)
Google Test - CMake With a Test Runner and Actual Application
What is a Unit Test?
Unit Test Characteristics
Types of Testing
Unit Test Structure (Slides)
Unit Test Structure (Code Example)
Assertions (Code Example)
Assertions on Strings - Wrong Way To Do It
Assertions on Strings
Assertions on Strings (Code Example)
Assertions on Exceptions
Assertions on Exceptions (Code Example)
Parameterized Tests (Code Example)
Google Mock Visual Studio (Windows)
Google Mock CMake Sample (Linux)
Mocking Project Resources
Introduction to Mocking
Presentation of Our Project
Mocking Methods - Current Way (Code Example)
Mocking Methods - Legacy (Code Example)
Setting Expectations and Behaviour
Mocking - Times (Code Example)
Mocking - Returns (Code Example)
Invoking Actions (Code Example)
Matchers (Code Example)
Assertions on Vectors (Code Example)
Mocking Private and Static Methods
Running a subset of tests, FAIL() and SUCCEED()
Visual Studio Test Runner
Arguments in Visual Studio (generating XML report)