Google Code Exporter | c3d8269 | 2015-08-24 18:41:02 -0400 | [diff] [blame] | 1 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 2 | # Google Test # |
Billy Donahue | 3f4e79b | 2015-08-26 21:45:10 -0400 | [diff] [blame] | 3 | |
Billy Donahue | 604bd64 | 2015-08-31 09:43:03 -0400 | [diff] [blame] | 4 | [](https://travis-ci.org/google/googletest) |
| 5 | |
Billy Donahue | bf5753a | 2015-08-25 19:17:02 -0400 | [diff] [blame] | 6 | Welcome to **Google Test**, Google's C++ test framework! |
Google Code Exporter | c3d8269 | 2015-08-24 18:41:02 -0400 | [diff] [blame] | 7 | |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 8 | This repository is a merger of the formerly separate GoogleTest and |
| 9 | GoogleMock projects. These were so closely related that it makes sense to |
| 10 | maintain and release them together. |
Google Code Exporter | c3d8269 | 2015-08-24 18:41:02 -0400 | [diff] [blame] | 11 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 12 | Please see the project page above for more information as well as the |
| 13 | mailing list for questions, discussions, and development. There is |
| 14 | also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please |
| 15 | join us! |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 16 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 17 | **Google Mock** is an extension to Google Test for writing and using C++ mock |
| 18 | classes. See the separate [Google Mock documentation](googlemock/README.md). |
| 19 | |
Billy Donahue | da25f9e | 2015-08-30 12:38:08 -0400 | [diff] [blame] | 20 | More detailed documentation for googletest (including build instructions) are |
| 21 | in its interior [googletest/README.md](googletest/README.md) file. |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 22 | |
| 23 | ## Features ## |
| 24 | |
| 25 | * An [XUnit](https://en.wikipedia.org/wiki/XUnit) test framework. |
| 26 | * Test discovery. |
| 27 | * A rich set of assertions. |
| 28 | * User-defined assertions. |
| 29 | * Death tests. |
| 30 | * Fatal and non-fatal failures. |
| 31 | * Value-parameterized tests. |
| 32 | * Type-parameterized tests. |
| 33 | * Various options for running the tests. |
| 34 | * XML test report generation. |
Billy Donahue | 7563fe5 | 2015-08-25 17:56:57 -0400 | [diff] [blame] | 35 | |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 36 | ## Platforms ## |
Billy Donahue | 7563fe5 | 2015-08-25 17:56:57 -0400 | [diff] [blame] | 37 | |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 38 | Google test has been used on a variety of platforms: |
| 39 | |
| 40 | * Linux |
| 41 | * Mac OS X |
| 42 | * Windows |
| 43 | * Cygwin |
| 44 | * MinGW |
| 45 | * Windows Mobile |
| 46 | * Symbian |
Billy Donahue | 7563fe5 | 2015-08-25 17:56:57 -0400 | [diff] [blame] | 47 | |
| 48 | ## Who Is Using Google Test? ## |
| 49 | |
| 50 | In addition to many internal projects at Google, Google Test is also used by |
| 51 | the following notable projects: |
| 52 | |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 53 | * The [Chromium projects](http://www.chromium.org/) (behind the Chrome |
| 54 | browser and Chrome OS). |
| 55 | * The [LLVM](http://llvm.org/) compiler. |
| 56 | * [Protocol Buffers](http://code.google.com/p/protobuf/), Google's data |
| 57 | interchange format. |
| 58 | * The [OpenCV](http://opencv.org/) computer vision library. |
Billy Donahue | 7563fe5 | 2015-08-25 17:56:57 -0400 | [diff] [blame] | 59 | |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 60 | ## Related Open Source Projects ## |
Billy Donahue | 7563fe5 | 2015-08-25 17:56:57 -0400 | [diff] [blame] | 61 | |
Billy Donahue | d945d8c | 2015-08-27 10:26:17 -0400 | [diff] [blame] | 62 | [Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 63 | your test binary, allows you to track its progress via a progress bar, and |
| 64 | displays a list of test failures. Clicking on one shows failure text. Google |
| 65 | Test UI is written in C#. |
Billy Donahue | 7563fe5 | 2015-08-25 17:56:57 -0400 | [diff] [blame] | 66 | |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 67 | [GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event |
| 68 | listener for Google Test that implements the |
| 69 | [TAP protocol](http://en.wikipedia.org/wiki/Test_Anything_Protocol) for test |
| 70 | result output. If your test runner understands TAP, you may find it useful. |
| 71 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 72 | ## Requirements ## |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 73 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 74 | Google Test is designed to have fairly minimal requirements to build |
| 75 | and use with your projects, but there are some. Currently, we support |
| 76 | Linux, Windows, Mac OS X, and Cygwin. We will also make our best |
| 77 | effort to support other platforms (e.g. Solaris, AIX, and z/OS). |
| 78 | However, since core members of the Google Test project have no access |
| 79 | to these platforms, Google Test may have outstanding issues there. If |
| 80 | you notice any problems on your platform, please notify |
| 81 | <googletestframework@googlegroups.com>. Patches for fixing them are |
| 82 | even more welcome! |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 83 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 84 | ### Linux Requirements ### |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 85 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 86 | These are the base requirements to build and use Google Test from a source |
| 87 | package (as described below): |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 88 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 89 | * GNU-compatible Make or gmake |
| 90 | * POSIX-standard shell |
| 91 | * POSIX(-2) Regular Expressions (regex.h) |
| 92 | * A C++98-standard-compliant compiler |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 93 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 94 | ### Windows Requirements ### |
Billy Donahue | 3f4e79b | 2015-08-26 21:45:10 -0400 | [diff] [blame] | 95 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 96 | * Microsoft Visual C++ v7.1 or newer |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 97 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 98 | ### Cygwin Requirements ### |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 99 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 100 | * Cygwin v1.5.25-14 or newer |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 101 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 102 | ### Mac OS X Requirements ### |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 103 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 104 | * Mac OS X v10.4 Tiger or newer |
| 105 | * XCode Developer Tools |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 106 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 107 | ### Requirements for Contributors ### |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 108 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 109 | We welcome patches. If you plan to contribute a patch, you need to |
| 110 | build Google Test and its own tests from a git checkout (described |
| 111 | below), which has further requirements: |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 112 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 113 | * [Python](http://python.org/) v2.3 or newer (for running some of |
| 114 | the tests and re-generating certain source files from templates) |
| 115 | * [CMake](http://www.cmake.org/) v2.6.4 or newer |
| 116 | |
| 117 | ## Regenerating Source Files ## |
Billy Donahue | 5b3ef3b | 2015-08-25 18:23:36 -0400 | [diff] [blame] | 118 | |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 119 | Some of Google Test's source files are generated from templates (not |
Billy Donahue | b55ac7f | 2015-08-30 12:13:33 -0400 | [diff] [blame] | 120 | in the C++ sense) using a script. |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 121 | For example, the |
| 122 | file include/gtest/internal/gtest-type-util.h.pump is used to generate |
| 123 | gtest-type-util.h in the same directory. |
| 124 | |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 125 | You don't need to worry about regenerating the source files |
| 126 | unless you need to modify them. You would then modify the |
| 127 | corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)' |
Billy Donahue | 4af3c08 | 2015-08-26 18:29:25 -0400 | [diff] [blame] | 128 | generator script. See the [Pump Manual](googletest/docs/PumpManual.md). |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 129 | |
| 130 | ### Contributing Code ### |
| 131 | |
Billy Donahue | 23bd6d8 | 2015-08-30 12:36:37 -0400 | [diff] [blame] | 132 | We welcome patches. Please read the |
| 133 | [Developer's Guide](googletest/docs/DevGuide.md) |
Billy Donahue | 37b5c29 | 2015-08-26 18:28:20 -0400 | [diff] [blame] | 134 | for how you can contribute. In particular, make sure you have signed |
| 135 | the Contributor License Agreement, or we won't be able to accept the |
| 136 | patch. |
| 137 | |
| 138 | Happy testing! |