From Apache OpenOffice Wiki
Revision as of 11:08, 30 May 2014 by Jsc (Talk | contribs)

Jump to: navigation, search

googletest is Google's framework for writing C++ tests (unit tests) on a variety of platforms. The intention is to use this test framework as replacement for cppunit that is license incompatible with Apache.

What googletest (gtest) is and a general introduction how to use it can be found on the googletest webpage. The documentation is very useful and provide some good examples, starting with a primer up to more comprehensive documentation for complex test.

Unit tests will be enabled by default in the future but can be disabled during configure. Simply add the --disable-unit-tests to your configure command.

How to use gtest

gtest is not yet fully integrated in gbuild but available in dmake makefiles. If we will continue with gbuild a better and direct integration have to be provided. But for now you can easy use with a dmake file. Up to 9 run unit test targets are supported and you can easy enable or disable the execution of one test. For example a simple makefile can look like this:

PRJ = ..
TARGET = salunittest
	@echo unit tests are disabled. Nothing to do.
APP1OBJS = $(OBJ)/unittest.obj
APP1TARGET = salunittest
APP1TEST = enabled
#APP1TEST = disabled

The whole test (directory) gets build only if unit tests are not disabled globally during configure. If you have several test binaries in one directory you can easy disable the execution of one test by setting the variable APP1TEST=disable

Personal tools