How to start working with GTest and CMake

The solution involved putting the gtest source directory as a subdirectory of your project. I’ve included the working CMakeLists.txt below if it is helpful to anyone. cmake_minimum_required(VERSION 2.6) project(basic_test) ################################ # GTest ################################ ADD_SUBDIRECTORY (gtest-1.6.0) enable_testing() include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}) ################################ # Unit Tests ################################ # Add test cpp file add_executable( runUnitTests testgtest.cpp ) # Link test … Read more

What is unit testing? [closed]

Unit testing is, roughly speaking, testing bits of your code in isolation with test code. The immediate advantages that come to mind are: Running the tests becomes automate-able and repeatable You can test at a much more granular level than point-and-click testing via a GUI Note that if your test code writes to a file, … Read more

Should one test internal implementation, or only test public behaviour?

The answer is very simple: you are describing functional testing, which is an important part of software QA. Testing internal implementation is unit-testing, which is another part of software QA with a different goal. That’s why you are feeling that people disagree with your approach. Functional testing is important to validate that the system or … Read more

How to run only one unit test class using Gradle

To run a single test class Airborn’s answer is good. With using some command line options, which found here, you can simply do something like this. gradle test –tests org.gradle.SomeTest.someSpecificFeature gradle test –tests *SomeTest.someSpecificFeature gradle test –tests *SomeSpecificTest gradle test –tests all.in.specific.package* gradle test –tests *IntegTest gradle test –tests *IntegTest*ui* gradle test –tests *IntegTest.singleMethod gradle … Read more