Transcript
Page 1: Google C++ Testing Framework

Google C++ Testing Framework

Dr. Frank XuGannon University

Page 2: Google C++ Testing Framework

OverviewDownloadInstallationCompilationTest a demo

Page 3: Google C++ Testing Framework

Download

Page 4: Google C++ Testing Framework
Page 5: Google C++ Testing Framework

Installation

Page 6: Google C++ Testing Framework

Assume we are using MSVSClick msvs

Page 7: Google C++ Testing Framework

Compilation

Page 8: Google C++ Testing Framework
Page 9: Google C++ Testing Framework
Page 10: Google C++ Testing Framework
Page 11: Google C++ Testing Framework

After compilation, you will see gtestd.lib

Page 12: Google C++ Testing Framework

DemoWin32 Console Application

Page 13: Google C++ Testing Framework

Important GTEST_ROOT

C:\Users\Frank\Desktop\svnrepository\MyDoc\public_html\teaching\shared\software\gtest-1.5.0

Make sure you have GTEST_ROOT/include in the header search path so that the compiler can find <gtest/gtest.h> when compiling your test. ◦ C:\Users\Frank\Desktop\svnrepository\MyDoc\

public_html\teaching\shared\software\gtest-1.5.0\include

Set up your test project to link with the Google Test library (for example, in Visual Studio, this is done by adding a dependency on gtest.vcproj).◦ C:\Users\Frank\Desktop\svnrepository\MyDoc\

public_html\teaching\shared\software\gtest-1.5.0\msvc\gtest\Debug\gtestd.lib

Page 14: Google C++ Testing Framework
Page 15: Google C++ Testing Framework
Page 16: Google C++ Testing Framework
Page 17: Google C++ Testing Framework

Testing

Greatest common divisor (gcd)

Page 18: Google C++ Testing Framework

Generated Executable file

Page 19: Google C++ Testing Framework

Execute Tests

Page 20: Google C++ Testing Framework
Page 21: Google C++ Testing Framework

Conclusion

[TestCaseName, TestName]Confusing:

◦[TestSuiteName, TestPurpose]◦{

test case 1 Test case 2

◦}


Top Related