In order to make it easier for everyone to write good C++ tests, today Google has open-sourced Google C++ Testing Framework (Google Test for short), a library that thousands of Googlers have been using in C++ programs. Highlights of the project include:
- Google Test is portable: it works on a variety of platforms (Linux, Windows, Mac OS X, and more), with several versions of GCC and MSVC compilers, and with or without exceptions. You can even use it in embedded systems like Windows CE and Symbian. Build tools and test runners for many of these are under active development, with Linux Autotools support already in place.
- It supports both fatal and nonfatal assertions. The test will continue after a nonfatal failure. This allows more problems to be uncovered and fixed in a single edit-compile-test cycle.
- It provides many assertions for common testing needs, and lets you easily define new assertions for less common cases.
- On Linux, you can write death tests to ensure that your code crashes with expected errors.
- Because it's based on the popular xUnit architecture, Google Test is easy to learn if you've used any testing framework in this family before.
It will take you about 10 minutes to learn the basics and get started.
No comments:
Post a Comment