Documentation sync working on the documentation being included with the code
This commit is contained in:
parent
cd6b9ae324
commit
e110929a7b
|
@ -201,48 +201,6 @@ is not feasible, for example in a C project using Google Test for validation,
|
|||
then it can be specified by adding it to the options for cmake via the
|
||||
`DCMAKE_CXX_FLAGS` option.
|
||||
|
||||
### Legacy Build Scripts
|
||||
|
||||
Before settling on CMake, we have been providing hand-maintained build
|
||||
projects/scripts for Visual Studio, Xcode, and Autotools. While we continue to
|
||||
provide them for convenience, they are not actively maintained any more. We
|
||||
highly recommend that you follow the instructions in the above sections to
|
||||
integrate Google Test with your existing build system.
|
||||
|
||||
If you still need to use the legacy build scripts, here's how:
|
||||
|
||||
The msvc\ folder contains two solutions with Visual C++ projects. Open the
|
||||
`gtest.sln` or `gtest-md.sln` file using Visual Studio, and you are ready to
|
||||
build Google Test the same way you build any Visual Studio project. Files that
|
||||
have names ending with -md use DLL versions of Microsoft runtime libraries (the
|
||||
/MD or the /MDd compiler option). Files without that suffix use static versions
|
||||
of the runtime libraries (the /MT or the /MTd option). Please note that one must
|
||||
use the same option to compile both gtest and the test code. If you use Visual
|
||||
Studio 2005 or above, we recommend the -md version as /MD is the default for new
|
||||
projects in these versions of Visual Studio.
|
||||
|
||||
On Mac OS X, open the `gtest.xcodeproj` in the `xcode/` folder using Xcode.
|
||||
Build the "gtest" target. The universal binary framework will end up in your
|
||||
selected build directory (selected in the Xcode "Preferences..." -> "Building"
|
||||
pane and defaults to xcode/build). Alternatively, at the command line, enter:
|
||||
|
||||
xcodebuild
|
||||
|
||||
This will build the "Release" configuration of gtest.framework in your default
|
||||
build location. See the "xcodebuild" man page for more information about
|
||||
building different configurations and building in different locations.
|
||||
|
||||
If you wish to use the Google Test Xcode project with Xcode 4.x and above, you
|
||||
need to either:
|
||||
|
||||
* update the SDK configuration options in xcode/Config/General.xconfig.
|
||||
Comment options `SDKROOT`, `MACOS_DEPLOYMENT_TARGET`, and `GCC_VERSION`. If
|
||||
you choose this route you lose the ability to target earlier versions of
|
||||
MacOS X.
|
||||
* Install an SDK for an earlier version. This doesn't appear to be supported
|
||||
by Apple, but has been reported to work
|
||||
(http://stackoverflow.com/questions/5378518).
|
||||
|
||||
### Tweaking Google Test
|
||||
|
||||
Google Test can be used in diverse environments. The default configuration may
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
# Googletest Primer
|
||||
|
||||
|
||||
## Introduction: Why googletest?
|
||||
|
||||
*googletest* helps you write better C++ tests.
|
||||
|
||||
googletest is a testing framework developed by the Testing
|
||||
Technology team with Google's specific
|
||||
requirements and constraints in mind. No matter whether you work on Linux,
|
||||
Windows, or a Mac, if you write C++ code, googletest can help you. And it
|
||||
supports *any* kind of tests, not just unit tests.
|
||||
googletest is a testing framework developed by the Testing Technology team with
|
||||
Google's specific requirements and constraints in mind. No matter whether you
|
||||
work on Linux, Windows, or a Mac, if you write C++ code, googletest can help
|
||||
you. And it supports *any* kind of tests, not just unit tests.
|
||||
|
||||
So what makes a good test, and how does googletest fit in? We believe:
|
||||
|
||||
|
@ -18,15 +16,14 @@ So what makes a good test, and how does googletest fit in? We believe:
|
|||
tests by running each of them on a different object. When a test fails,
|
||||
googletest allows you to run it in isolation for quick debugging.
|
||||
1. Tests should be well *organized* and reflect the structure of the tested
|
||||
code. googletest groups related tests into test cases that can share data
|
||||
code. googletest groups related tests into test suites that can share data
|
||||
and subroutines. This common pattern is easy to recognize and makes tests
|
||||
easy to maintain. Such consistency is especially helpful when people switch
|
||||
projects and start to work on a new code base.
|
||||
1. Tests should be *portable* and *reusable*. Google has a lot of code that is
|
||||
platform-neutral, its tests should also be platform-neutral. googletest
|
||||
works on different OSes, with different compilers, with
|
||||
or without exceptions, so googletest tests can work with a variety of
|
||||
configurations.
|
||||
works on different OSes, with different compilers, with or without
|
||||
exceptions, so googletest tests can work with a variety of configurations.
|
||||
1. When tests fail, they should provide as much *information* about the problem
|
||||
as possible. googletest doesn't stop at the first test failure. Instead, it
|
||||
only stops the current test and continues with the next. You can also set up
|
||||
|
@ -71,9 +68,9 @@ and refactored away
|
|||
|
||||
So please be aware of the different definitions of the terms:
|
||||
|
||||
Meaning | googletest Term | [ISTQB](http://www.istqb.org/) Term
|
||||
:----------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------- | :----------------------------------
|
||||
Exercise a particular program path with specific input values and verify the results | [TEST()](#simple-tests) | [Test Case](http://glossary.istqb.org/search/test%20case)
|
||||
Meaning | googletest Term | [ISTQB](http://www.istqb.org/) Term
|
||||
:----------------------------------------------------------------------------------- | :---------------------- | :----------------------------------
|
||||
Exercise a particular program path with specific input values and verify the results | [TEST()](#simple-tests) | [Test Case](http://glossary.istqb.org/search/test%20case)
|
||||
|
||||
## Basic Concepts
|
||||
|
||||
|
@ -85,15 +82,15 @@ current function; otherwise the program continues normally.
|
|||
*Tests* use assertions to verify the tested code's behavior. If a test crashes
|
||||
or has a failed assertion, then it *fails*; otherwise it *succeeds*.
|
||||
|
||||
A *test case* contains one or many tests. You should group your tests into test
|
||||
cases that reflect the structure of the tested code. When multiple tests in a
|
||||
test case need to share common objects and subroutines, you can put them into a
|
||||
A *test suite* contains one or many tests. You should group your tests into test
|
||||
suites that reflect the structure of the tested code. When multiple tests in a
|
||||
test suite need to share common objects and subroutines, you can put them into a
|
||||
*test fixture* class.
|
||||
|
||||
A *test program* can contain multiple test cases.
|
||||
A *test program* can contain multiple test suites.
|
||||
|
||||
We'll now explain how to write a test program, starting at the individual
|
||||
assertion level and building up to tests and test cases.
|
||||
assertion level and building up to tests and test suites.
|
||||
|
||||
## Assertions
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user