readme merging
This commit is contained in:
parent
4af3c08579
commit
3f4e79b999
32
README.md
32
README.md
|
@ -1,12 +1,12 @@
|
|||
|
||||
## Google Test ##
|
||||
|
||||
Welcome to **Google Test**, Google's C++ test framework!
|
||||
|
||||
This repository is a merger of the formerly separate GoogleTest and
|
||||
GoogleMock projects. These were so closely related that it makes sense to
|
||||
maintain and release them together.
|
||||
|
||||
## Google Test ##
|
||||
|
||||
Google Test conforms to the [XUnit](https://en.wikipedia.org/wiki/XUnit)
|
||||
test framework pattern. It features:
|
||||
|
||||
|
@ -58,9 +58,12 @@ result output. If your test runner understands TAP, you may find it useful.
|
|||
|
||||
## About Google Mock ##
|
||||
|
||||
**Google Mock** is an extension to Google Test for writing and using C++ mock classes.
|
||||
It is inspired by [jMock](http://www.jmock.org/), [EasyMock](http://www.easymock.org/),
|
||||
and [Hamcrest](http://code.google.com/p/hamcrest/), and designed with C++'s specifics in mind.
|
||||
**Google Mock** is an extension to Google Test for writing and using C++ mock
|
||||
classes. It is inspired by
|
||||
[jMock](http://www.jmock.org/),
|
||||
[EasyMock](http://www.easymock.org/), and
|
||||
[Hamcrest](http://code.google.com/p/hamcrest/),
|
||||
and designed with C++'s specifics in mind.
|
||||
|
||||
Google mock:
|
||||
|
||||
|
@ -71,7 +74,8 @@ Google mock:
|
|||
|
||||
We hope you find it useful!
|
||||
|
||||
## Using Google Mock Without Google Test ##
|
||||
### Using Google Mock Without Google Test ###
|
||||
|
||||
Google Mock is not a testing framework itself. Instead, it needs a
|
||||
testing framework for writing tests. Google Mock works seamlessly
|
||||
with [Google Test](http://code.google.com/p/googletest/), butj
|
||||
|
@ -82,21 +86,25 @@ you can also use it with [any C++ testing framework](googlemock/ForDummies.md#Us
|
|||
If you are new to the project, we suggest that you read the user
|
||||
documentation in the following order:
|
||||
|
||||
* Learn the [basics](http://code.google.com/p/googletest/wiki/Primer) of
|
||||
* Learn the [basics](googletest/docs/Primer) of
|
||||
Google Test, if you choose to use Google Mock with it (recommended).
|
||||
* Read [Google Mock for Dummies](ForDummies.md).
|
||||
* Read [Google Mock for Dummies](googlemock/docs/ForDummies.md).
|
||||
* Read the instructions on how to [build Google Mock](googlemock/README.md).
|
||||
|
||||
You can also watch Zhanyong's [talk](http://www.youtube.com/watch?v=sYpCyLI47rM) on Google Mock's usage and implementation.
|
||||
|
||||
Once you understand the basics, check out the rest of the docs:
|
||||
|
||||
* [CheatSheet](googlemock/docs/CheatSheet.md) - all the commonly used stuff at a glance.
|
||||
* [CookBook](googlemock/docs/CookBook.md) - recipes for getting things done, including advanced techniques.
|
||||
* [CheatSheet](googlemock/docs/CheatSheet.md) - all the commonly used stuff
|
||||
at a glance.
|
||||
* [CookBook](googlemock/docs/CookBook.md) - recipes for getting things done,
|
||||
including advanced techniques.
|
||||
|
||||
If you need help, please check the [KnownIssues](googlemock/docs/KnownIssues.md) and
|
||||
If you need help, please check the
|
||||
[KnownIssues](googlemock/docs/KnownIssues.md) and
|
||||
[FrequentlyAskedQuestions](googlemock/docs/frequentlyaskedquestions.md) before
|
||||
posting a question on the [googlemock discussion group](http://groups.google.com/group/googlemock).
|
||||
posting a question on the
|
||||
[discussion group](http://groups.google.com/group/googlemock).
|
||||
|
||||
### Regenerating Source Files ###
|
||||
|
||||
|
|
|
@ -10,40 +10,38 @@ Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
|
|||
specifics in mind, it can help you derive better designs of your
|
||||
system and write better tests.
|
||||
|
||||
Google Mock:
|
||||
### Features ###
|
||||
|
||||
- provides a declarative syntax for defining mocks,
|
||||
- can easily define partial (hybrid) mocks, which are a cross of real
|
||||
and mock objects,
|
||||
- handles functions of arbitrary types and overloaded functions,
|
||||
- comes with a rich set of matchers for validating function arguments,
|
||||
- uses an intuitive syntax for controlling the behavior of a mock,
|
||||
- does automatic verification of expectations (no record-and-replay
|
||||
needed),
|
||||
- allows arbitrary (partial) ordering constraints on
|
||||
function calls to be expressed,
|
||||
- lets a user extend it by defining new matchers and actions.
|
||||
- does not use exceptions, and
|
||||
- is easy to learn and use.
|
||||
* Provides a declarative syntax for defining mocks.
|
||||
* Can easily define partial (hybrid) mocks, which are a cross of real
|
||||
and mock objects.
|
||||
* Handles functions of arbitrary types and overloaded functions.
|
||||
* Comes with a rich set of matchers for validating function arguments.
|
||||
* Uses an intuitive syntax for controlling the behavior of a mock.
|
||||
* Does automatic verification of expectations (no record-and-replay needed).
|
||||
* Allows arbitrary (partial) ordering constraints on
|
||||
function calls to be expressed,.
|
||||
* Lets a user extend it by defining new matchers and actions.
|
||||
* Does not use exceptions.
|
||||
* Is easy to learn and use.
|
||||
|
||||
Please see the project page above for more information as well as the
|
||||
mailing list for questions, discussions, and development. There is
|
||||
also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
|
||||
join us!
|
||||
|
||||
Please note that code under scripts/generator/ is from the [cppclean
|
||||
project](http://code.google.com/p/cppclean/) and under the Apache
|
||||
License, which is different from Google Mock's license.
|
||||
Please note that code under [scripts/generator](scripts/generator/) is
|
||||
from [cppclean](http://code.google.com/p/cppclean/) and released under
|
||||
the Apache License, which is different from Google Mock's license.
|
||||
|
||||
### Requirements for End Users ###
|
||||
|
||||
Google Mock is implemented on top of [Google Test](
|
||||
http://github.com/google/googletest/), and depends on it.
|
||||
http://github.com/google/googletest/), and depends on it.
|
||||
You must use the bundled version of Google Test when using Google Mock.
|
||||
|
||||
You can also easily configure Google Mock to work with another testing
|
||||
framework, although it will still need Google Test. Please read
|
||||
|
||||
["Using_Google_Mock_with_Any_Testing_Framework"](
|
||||
docs/ForDummies.md#Using_Google_Mock_with_Any_Testing_Framework)
|
||||
for instructions.
|
||||
|
@ -53,9 +51,6 @@ modern compiler. The following are needed to use Google Mock:
|
|||
|
||||
#### Linux Requirements ####
|
||||
|
||||
These are the base requirements to build and use Google Mock from a source
|
||||
package (as described below):
|
||||
|
||||
* GNU-compatible Make or "gmake"
|
||||
* POSIX-standard shell
|
||||
* POSIX(-2) Regular Expressions (regex.h)
|
||||
|
@ -72,9 +67,8 @@ package (as described below):
|
|||
|
||||
### Requirements for Contributors ###
|
||||
|
||||
We welcome patches. If you plan to contribute a patch, you need to
|
||||
build Google Mock and its own tests from an SVN checkout (described
|
||||
below), which has further requirements:
|
||||
We welcome patches. If you plan to contribute a patch, you need to
|
||||
build Google Mock and its tests, which has further requirements:
|
||||
|
||||
* Automake version 1.9 or newer
|
||||
* Autoconf version 2.59 or newer
|
||||
|
@ -82,60 +76,29 @@ below), which has further requirements:
|
|||
* Python version 2.3 or newer (for running some of the tests and
|
||||
re-generating certain source files from templates)
|
||||
|
||||
### Getting the Source ###
|
||||
### Building Google Mock ###
|
||||
|
||||
There are two primary ways of getting Google Mock's source code: you
|
||||
can download a [stable source release](releases),
|
||||
or directly check out the source from our Git repository.
|
||||
The Git checkout requires a few extra steps and some extra software
|
||||
packages on your system, but lets you track development and make
|
||||
patches much more easily, so we highly encourage it.
|
||||
#### Preparing to Build (Unix only) ####
|
||||
|
||||
### Git Checkout ###
|
||||
|
||||
To check out the master branch of Google Mock, run the following git command:
|
||||
|
||||
git clone https://github.com/google/googlemock.git
|
||||
|
||||
If you are using a \*nix system and plan to use the GNU Autotools build
|
||||
If you are using a Unix system and plan to use the GNU Autotools build
|
||||
system to build Google Mock (described below), you'll need to
|
||||
configure it now. Otherwise you are done with getting the source
|
||||
files.
|
||||
configure it now.
|
||||
|
||||
To prepare the Autotools build system, enter the target directory of
|
||||
the checkout command you used ('gmock-svn') and proceed with the
|
||||
following command:
|
||||
To prepare the Autotools build system:
|
||||
|
||||
cd googlemock
|
||||
autoreconf -fvi
|
||||
|
||||
Once you have completed this step, you are ready to build the library.
|
||||
Note that you should only need to complete this step once. The
|
||||
subsequent 'make' invocations will automatically re-generate the bits
|
||||
of the build system that need to be changed.
|
||||
|
||||
If your system uses older versions of the autotools, the above command
|
||||
will fail. You may need to explicitly specify a version to use. For
|
||||
instance, if you have both GNU Automake 1.4 and 1.9 installed and
|
||||
'automake' would invoke the 1.4, use instead:
|
||||
|
||||
AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf -fvi
|
||||
|
||||
Make sure you're using the same version of automake and aclocal.
|
||||
|
||||
### Preparing to Build ###
|
||||
|
||||
To build Google Mock and your tests that use it, you need to tell your
|
||||
build system where to find its headers and source files. The exact
|
||||
way to do it depends on which build system you use, and is usually
|
||||
straightforward.
|
||||
|
||||
### Build ###
|
||||
|
||||
This section shows how you can integrate Google Mock into your
|
||||
existing build system.
|
||||
|
||||
Suppose you put Google Mock in directory ${GMOCK\_DIR} and Google Test
|
||||
in ${GTEST\_DIR} (the latter is ${GMOCK\_DIR}/gtest by default). To
|
||||
Suppose you put Google Mock in directory `${GMOCK_DIR}` and Google Test
|
||||
in `${GTEST_DIR}` (the latter is `${GMOCK_DIR}/gtest` by default). To
|
||||
build Google Mock, create a library build target (or a project as
|
||||
called by Visual Studio and Xcode) to compile
|
||||
|
||||
|
@ -183,7 +146,8 @@ following commands should succeed:
|
|||
make
|
||||
./gmock_test
|
||||
|
||||
If you see errors, try to tweak the contents of [make/Makefile](make/Makefile) to make them go away.
|
||||
If you see errors, try to tweak the contents of
|
||||
[make/Makefile](make/Makefile) to make them go away.
|
||||
|
||||
### Windows ###
|
||||
|
||||
|
@ -285,7 +249,6 @@ use the new matcher API (
|
|||
[polymorphic](http://code.google.com/p/googlemock/wiki/CookBook#Writing_New_Polymorphic_Matchers)).
|
||||
Matchers defined using `MATCHER()` or `MATCHER_P*()` aren't affected.
|
||||
|
||||
|
||||
### Developing Google Mock ###
|
||||
|
||||
This section discusses how to make your own changes to Google Mock.
|
||||
|
|
|
@ -65,29 +65,6 @@ below), which has further requirements:
|
|||
re-generating certain source files from templates)
|
||||
* [CMake](http://www.cmake.org/) 2.6.4 or newer
|
||||
|
||||
## Getting the Source ##
|
||||
|
||||
Google Test's source is available from its GitHub repository at
|
||||
<https://github.com/google/googletest>.
|
||||
The GitHub repository offers stable tagged releases available as .ZIP archives.
|
||||
A Git checkout requires a few extra steps and some extra software
|
||||
packages on your system, but lets you track the latest development and
|
||||
make patches much more easily, so we highly encourage it.
|
||||
|
||||
### Source Package ###
|
||||
|
||||
Snapshots of Google Test's master branch can be downloaded directly with
|
||||
GitHub's "Download ZIP" button on the main page.
|
||||
|
||||
Versioned releases are also available by clicking on
|
||||
[Releases](releases) in the project page.
|
||||
|
||||
### Git Checkout ###
|
||||
|
||||
To check out the master branch of Google Test, run the following git command:
|
||||
|
||||
git clone https://github.com/google/googletest.git (via HTTPS)
|
||||
|
||||
## Setting up the Build ##
|
||||
|
||||
To build Google Test and your tests that use it, you need to tell your
|
||||
|
|
Loading…
Reference in New Issue
Block a user