Index TableOfContents

About this document

This document describes in brief how to install the [http://code.google.com/p/googletest/ GoogleTest] framework under Unix and how to write and run test programs with it.

Installing

Get the code from http://code.google.com/p/googletest/downloads/list and install it, for example, under /var/tmp/gtest/install:

$ cd /var/tmp/
$ cp ~/gtest-1.2.1.tar.gz .
$ tar xzf gtest-1.2.1.tar.gz
$ ln -s gtest-1.2.1 gtest
$ cd gtest
$ configure --prefix=`pwd`/install
$ make
$ make install

Learning about

Now read the very fine and small introduction on http://code.google.com/p/googletest/wiki/GoogleTestPrimer.

Running a test program

Checkout or update the latest version of the autocompletion directory, change to the GoogleTest test directory, read the files Makefile and runGlobalsTest.cpp, and run the test:

$ cd ~/Hannah/autocompletion/
$ svn update
$ cd trials/UnitTests/GoogleTest/
$ make runtest
[...]

[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from GlobalsTest
[ RUN      ] GlobalsTest.NormalInput
[       OK ] GlobalsTest.NormalInput
[ RUN      ] GlobalsTest.InputWithMetaChars
[       OK ] GlobalsTest.InputWithMetaChars
[ RUN      ] GlobalsTest.InputThatIsJustEvil
[       OK ] GlobalsTest.InputThatIsJustEvil
[----------] Global test environment tear-down
[==========] 3 tests from 1 test case ran.
[  PASSED  ] 3 tests.

CompleteSearch: completesearch/InstallingAndRunningGoogleTest (last edited 2008-12-22 12:20:02 by mpiat1403)