Unit Testing with the Googletest C++ Testing Framework
2 days
Googletest is a framework for writing C++ tests on a variety of platforms (Linux, Mac OS X, Windows, Cygwin, Windows CE, and Symbian). It is based on the xUnit architecture and supports automatic test discovery, a rich set of assertions, user-defined assertions, death tests, fatal and non-fatal failures, value- and type-parameterized tests, various options for running the tests, and XML test report generation.
This course has two major objectives: 1) describe and apply good unit test practice, including test design and test performance, and 2) learn how to apply the Googletest framework with hands-on exercises.
Unit testing is a high leverage point to find defects early in a project when they are cheaper and easier to fix. Getting all your developers on the same page with this course is a big step toward higher software quality.
Instructor: Dr. Tauhida Parveen
Dr. Parveen has deep knowledge of C++ and how to test software written in C++. She is a skilled and articulate trainer with teaching experience at the Florida Institute of Technology. She has worked in major scientific projects and cutting-edge corporations.
Outline
1. Software Testing
a. Introduction
b. Levels of Testing
i. Unit
ii. Integration
iii. System
2. Unit Testing
a. What are unit tests
b. Benefit and drawback
c. Test Driven development (TDD)
d. What to test with unit tests and what not to test with unit tests
3. Basic structure of unit tests
a. Test case/tests
b. Test suite
c. Test fixtures
d. Set up
e. Tear down
f. Mocks/stubs
g. Creating, and executing unit tests
h. Test results
i. Guidelines for writing unit tests
j. An example
4. Unit testing frameworks
a. xUnit Architecture
b. cpp unit
c. Boost
d. Google Test
5. Google Test framework
a. Introduction/history
b. Comparison with other cpp unit testing framework
c. Main features
i. Portable
ii. Flexible
iii. Automatic detection of tests
iv. Death tests
v. Own mocking framework (Google Mock Framework)
vi. XML test report generation
6. Google Mock framework
7. Google Test syntax
a. Assertions
b. Binary, floating point and string comparison
c. Writing your first test
8. Setting up Google test
a. Environments
b. Dependencies
c. Writing test case
d. Executing test cases
i. Build file (make file)
e. Interpreting results
9. Sample Exercise
10. Summary