Command Line Arguments

  • Dump the output into XML format by passing:

–gtest_output=”xml:report.xml”

  • If want to run multiple times:

–gtest_repeat=2

  • Debugger invoked on failure:

–gtest_break_on_failure

  • Not all the tests needs to be run all the times:

–gtest_filter=<test string>


GTest Framework

Similar Reads

What is Googletest?

It is a test framework i.e., a software tool for writing and running unit tests. It is a library for writing C++ tests. It is based on xUnit architecture which is a set of “Frameworks” for programming and automated execution of test cases....

Why Googletest?

Googletest helps us to write better C++ tests. Independent and Repeatable: Googletest isolates the tests by running each of them on a different object. Portable and Reusable: Googletest works on different Oses (Linux, Windows, or a Mac), with different compilers. When tests fail, it should provide as much information about the problem as possible....

Nomenclature:

TestSuite:It is used for grouping related tests. TEST(): It exercises a particular program path with specific input values and verify the result....

Basic Concepts:

Assertions: A statements that check whether a condition is true. Output: success, nonfatal failure, or fatal failure(aborts the current function). Test fixture class: Collection of multiple tests in a test suite that need to share common objects and subroutines....

Simple tests:

TEST():...

Examples:

A factorial function:...

Command Line Arguments:

Dump the output into XML format by passing:...

Contact Us