Here is a simplest one,
1.Create a simple source file,
$ cat simplegtest.cpp
#include<gtest/gtest.h>
TEST(Mytest, failing_test){
EXPECT_TRUE(false);
}
2.Compile it using below command,
$ LDLIBS="-lgtest_main -lgtest" make simplegtest
g++ simplegtest.cpp -lgtest_main -lgtest -o simplegtest
3.Execute the test executable using below command,
$ ./simplegtest
Running main() from /home/prashant/work/thirdparty/googletest-release-1.8.1/googletest/src/gtest_main.cc
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from Mytest
[ RUN ] Mytest.failing_test
simplegtest.cpp:4: Failure
Value of: false
Actual: false
Expected: true
[ FAILED ] Mytest.failing_test (0 ms)
[----------] 1 test from Mytest (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (1 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] Mytest.failing_test
1 FAILED TEST