Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
3f4e79b9
Commit
3f4e79b9
authored
Aug 26, 2015
by
Billy Donahue
Browse files
readme merging
parent
4af3c085
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
102 deletions
+50
-102
README.md
README.md
+20
-12
googlemock/README.md
googlemock/README.md
+30
-67
googletest/README.md
googletest/README.md
+0
-23
No files found.
README.md
View file @
3f4e79b9
## Google Test ##
Welcome to
**Google Test**
, Google's C++ test framework!
Welcome to
**Google Test**
, Google's C++ test framework!
This repository is a merger of the formerly separate GoogleTest and
This repository is a merger of the formerly separate GoogleTest and
GoogleMock projects. These were so closely related that it makes sense to
GoogleMock projects. These were so closely related that it makes sense to
maintain and release them together.
maintain and release them together.
## Google Test ##
Google Test conforms to the
[
XUnit
](
https://en.wikipedia.org/wiki/XUnit
)
Google Test conforms to the
[
XUnit
](
https://en.wikipedia.org/wiki/XUnit
)
test framework pattern. It features:
test framework pattern. It features:
...
@@ -58,9 +58,12 @@ result output. If your test runner understands TAP, you may find it useful.
...
@@ -58,9 +58,12 @@ result output. If your test runner understands TAP, you may find it useful.
## About Google Mock ##
## About Google Mock ##
**Google Mock**
is an extension to Google Test for writing and using C++ mock classes.
**Google Mock**
is an extension to Google Test for writing and using C++ mock
It is inspired by
[
jMock
](
http://www.jmock.org/
)
,
[
EasyMock
](
http://www.easymock.org/
)
,
classes. It is inspired by
and
[
Hamcrest
](
http://code.google.com/p/hamcrest/
)
, and designed with C++'s specifics in mind.
[
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:
Google mock:
...
@@ -71,7 +74,8 @@ Google mock:
...
@@ -71,7 +74,8 @@ Google mock:
We hope you find it useful!
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
Google Mock is not a testing framework itself. Instead, it needs a
testing framework for writing tests. Google Mock works seamlessly
testing framework for writing tests. Google Mock works seamlessly
with
[
Google Test
](
http://code.google.com/p/googletest/
)
, butj
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
...
@@ -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
If you are new to the project, we suggest that you read the user
documentation in the following order:
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).
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
)
.
*
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.
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:
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.
*
[
CheatSheet
](
googlemock/docs/CheatSheet.md
)
- all the commonly used stuff
*
[
CookBook
](
googlemock/docs/CookBook.md
)
- recipes for getting things done, including advanced techniques.
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
[
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 ###
### Regenerating Source Files ###
...
...
googlemock/README.md
View file @
3f4e79b9
...
@@ -10,40 +10,38 @@ Inspired by jMock, EasyMock, and Hamcrest, and designed with C++'s
...
@@ -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
specifics in mind, it can help you derive better designs of your
system and write better tests.
system and write better tests.
Google Mock:
### Features ###
-
provides a declarative syntax for defining mocks,
*
Provides a declarative syntax for defining mocks.
-
can easily define partial (hybrid) mocks, which are a cross of real
*
Can easily define partial (hybrid) mocks, which are a cross of real
and mock objects,
and mock objects.
-
handles functions of arbitrary types and overloaded functions,
*
Handles functions of arbitrary types and overloaded functions.
-
comes with a rich set of matchers for validating function arguments,
*
Comes with a rich set of matchers for validating function arguments.
-
uses an intuitive syntax for controlling the behavior of a mock,
*
Uses an intuitive syntax for controlling the behavior of a mock.
-
does automatic verification of expectations (no record-and-replay
*
Does automatic verification of expectations (no record-and-replay needed).
needed),
*
Allows arbitrary (partial) ordering constraints on
-
allows arbitrary (partial) ordering constraints on
function calls to be expressed,.
function calls to be expressed,
*
Lets a user extend it by defining new matchers and actions.
-
lets a user extend it by defining new matchers and actions.
*
Does not use exceptions.
-
does not use exceptions, and
*
Is easy to learn and use.
-
is easy to learn and use.
Please see the project page above for more information as well as the
Please see the project page above for more information as well as the
mailing list for questions, discussions, and development. There is
mailing list for questions, discussions, and development. There is
also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please
join us!
join us!
Please note that code under scripts/generator
/ is from the
[
cppclean
Please note that code under
[
scripts/generator
](
scripts/generator/
)
is
p
ro
ject
](
http://code.google.com/p/cppclean/
)
and
under the Apache
f
ro
m
[
cppclean
](
http://code.google.com/p/cppclean/
)
and
released under
License, which is different from Google Mock's license.
the Apache
License, which is different from Google Mock's license.
### Requirements for End Users ###
### Requirements for End Users ###
Google Mock is implemented on top of
[
Google Test
](
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 must use the bundled version of Google Test when using Google Mock.
You can also easily configure Google Mock to work with another testing
You can also easily configure Google Mock to work with another testing
framework, although it will still need Google Test. Please read
framework, although it will still need Google Test. Please read
[
"Using_Google_Mock_with_Any_Testing_Framework"
](
[
"Using_Google_Mock_with_Any_Testing_Framework"
](
docs/ForDummies.md#Using_Google_Mock_with_Any_Testing_Framework
)
docs/ForDummies.md#Using_Google_Mock_with_Any_Testing_Framework
)
for instructions.
for instructions.
...
@@ -53,9 +51,6 @@ modern compiler. The following are needed to use Google Mock:
...
@@ -53,9 +51,6 @@ modern compiler. The following are needed to use Google Mock:
#### Linux Requirements ####
#### 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"
*
GNU-compatible Make or "gmake"
*
POSIX-standard shell
*
POSIX-standard shell
*
POSIX(-2) Regular Expressions (regex.h)
*
POSIX(-2) Regular Expressions (regex.h)
...
@@ -73,8 +68,7 @@ package (as described below):
...
@@ -73,8 +68,7 @@ package (as described below):
### Requirements for Contributors ###
### Requirements for Contributors ###
We welcome patches. If you plan to contribute a patch, you need to
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
build Google Mock and its tests, which has further requirements:
below), which has further requirements:
*
Automake version 1.9 or newer
*
Automake version 1.9 or newer
*
Autoconf version 2.59 or newer
*
Autoconf version 2.59 or newer
...
@@ -82,60 +76,29 @@ below), which has further requirements:
...
@@ -82,60 +76,29 @@ below), which has further requirements:
*
Python version 2.3 or newer (for running some of the tests and
*
Python version 2.3 or newer (for running some of the tests and
re-generating certain source files from templates)
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.
###
Git Checkout
###
###
# Preparing to Build (Unix only) #
###
To check out the master branch of Google Mock, run the following git command:
If you are using a Unix system and plan to use the GNU Autotools build
git clone https://github.com/google/googlemock.git
If you are using a
\*
nix system and plan to use the GNU Autotools build
system to build Google Mock (described below), you'll need to
system to build Google Mock (described below), you'll need to
configure it now. Otherwise you are done with getting the source
configure it now.
files.
To prepare the Autotools build system, enter the target directory of
To prepare the Autotools build system:
the checkout command you used ('gmock-svn') and proceed with the
following command:
cd googlemock
autoreconf -fvi
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
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
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
way to do it depends on which build system you use, and is usually
straightforward.
straightforward.
### Build ###
This section shows how you can integrate Google Mock into your
This section shows how you can integrate Google Mock into your
existing build system.
existing build system.
Suppose you put Google Mock in directory ${GMOCK
\
_
DIR} and Google Test
Suppose you put Google Mock in directory
`
${GMOCK_DIR}
`
and Google Test
in ${GTEST
\
_
DIR} (the latter is ${GMOCK
\
_
DIR}/gtest by default). To
in
`
${GTEST_DIR}
`
(the latter is
`
${GMOCK_DIR}/gtest
`
by default). To
build Google Mock, create a library build target (or a project as
build Google Mock, create a library build target (or a project as
called by Visual Studio and Xcode) to compile
called by Visual Studio and Xcode) to compile
...
@@ -183,7 +146,8 @@ following commands should succeed:
...
@@ -183,7 +146,8 @@ following commands should succeed:
make
make
./gmock_test
./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 ###
### Windows ###
...
@@ -285,7 +249,6 @@ use the new matcher API (
...
@@ -285,7 +249,6 @@ use the new matcher API (
[
polymorphic
](
http://code.google.com/p/googlemock/wiki/CookBook#Writing_New_Polymorphic_Matchers
)
).
[
polymorphic
](
http://code.google.com/p/googlemock/wiki/CookBook#Writing_New_Polymorphic_Matchers
)
).
Matchers defined using
`MATCHER()`
or
`MATCHER_P*()`
aren't affected.
Matchers defined using
`MATCHER()`
or
`MATCHER_P*()`
aren't affected.
### Developing Google Mock ###
### Developing Google Mock ###
This section discusses how to make your own changes to Google Mock.
This section discusses how to make your own changes to Google Mock.
...
...
googletest/README.md
View file @
3f4e79b9
...
@@ -65,29 +65,6 @@ below), which has further requirements:
...
@@ -65,29 +65,6 @@ below), which has further requirements:
re-generating certain source files from templates)
re-generating certain source files from templates)
*
[
CMake
](
http://www.cmake.org/
)
2.6.4 or newer
*
[
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 ##
## Setting up the Build ##
To build Google Test and your tests that use it, you need to tell your
To build Google Test and your tests that use it, you need to tell your
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment