googletest

What unit-testing framework should I use for Qt? [closed]

杀马特。学长 韩版系。学妹 提交于 2019-11-27 09:17:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I am just starting up a new project that needs some cross-platform GUI, and we have chosen Qt as the GUI-framework. We need a unit-testing framework, too. Until about a year ago we used an in-house developed unit-testing framework for C++-projects, but we are now transitioning to using Google Test for new

How can I use Google Test with my project that builds via autotools?

吃可爱长大的小学妹 提交于 2019-11-27 05:33:35
问题 It seems like there are a few answers that kind-of, sort-of make sense, but that I don't know how to carry out. And I haven't found a comprehensive answer. The First Problem Google Test should not be an installed library, it should be built with the project. (See the FAQ.) As far as I can tell, this means the Google Test libraries are a dependency of my unit tests, and should be built when I run "make check" within my project for the first time. This should build Google Test libraries in some

How to run specific test cases in GoogleTest

坚强是说给别人听的谎言 提交于 2019-11-27 04:02:03
问题 I am trying to write a function/method for my project, which will ask to user which all test cases are you going to run? It looks like below..., Test_Cases_1 |_TestNo1 |_TestNo2....so on Test_Cases_2 |_TestNo1 |_TestNo2....so on .... ....so on Test_Cases_N |_TestNo1 |_TestNo2....so on So, now the challenge is while running the project it should prompt me what all test cases you would like to execute? If I select Test_Cases_1 and Test_Cases_N . Then it should execute these two test cases and

How to set up googleTest as a shared library on Linux

时光毁灭记忆、已成空白 提交于 2019-11-27 02:35:56
Debian does not provide any precompiled packages for gTest anymore. They suggest you integrate the framework into your project's makefile. But I want to keep my makefile clean. How do I set up gTest like the former versions (<1.6.0), so that I can link against the library? ManuelSchneid3r Before you start make sure your have read and understood this note from Google ! This tutorial makes using gtest easy, but may introduce nasty bugs . 1. Get the googletest framework wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz Or get it by hand . I won't maintain this little How-to,

undefined reference to `pthread_key_create' (linker error)

我的未来我决定 提交于 2019-11-27 02:09:10
I have downloaded gtest 1.7.0 sources from here: https://code.google.com/p/googletest/downloads/list and build the gtest .a files (lib files) on ubuntu 13.10: Linux ubuntu 3.11.0-15-generic #23-Ubuntu SMP Mon Dec 9 18:17:04 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux and the resulting lib is called: libgtest.a . In my main.cpp file Have: #include <iostream> #include "gtest/gtest.h" int main(){ std::cout << "Test \n"; int argc = 2; char* cp01; char* cp02; char* argv[] = {cp01, cp02}; testing::InitGoogleTest(&argc, argv); return 0; } From a terminal I build with: g++ main.cpp -I/home/user/gtest-1.7

Can gmock be used for stubbing C functions?

谁都会走 提交于 2019-11-27 01:54:52
问题 I am new to gmock, so I want to know how can I stub simple C function called in a function under test for Unit Testing. Example: int func(int a) { boolean find; // Some code find = func_1(); return find; } I have searched about gmock and in my understanding gmock does not provide functionality to stub simple C functions, therefore I want to ask does gmock provides functionality to mock or stub func_1 ? If not how can I stub func_1 manually in my test code without changing source code? I am

C++ project organisation (with gtest, cmake and doxygen)

♀尐吖头ヾ 提交于 2019-11-26 23:44:45
问题 I am new to programming in general so I decided that I would start by making a simple vector class in C++. However I would like to get in to good habits from the start rather than trying to modify my workflow later on. I currently have only two files vector3.hpp and vector3.cpp . This project will slowly start to grow (making it much more of a general linear algebra library) as I become more familiar with everything, so I would like to adopt a "standard" project layout to make life easier

How to start working with GTest and CMake

僤鯓⒐⒋嵵緔 提交于 2019-11-26 23:24:47
I have recently been sold on using CMake for compiling my C++ projects, and would now like to start writing some unit tests for my code. I have decided to use the Google Test utility to help with this, but require some help in getting started. All day I have been reading various guides and examples include the Primer , an introduction at IBM and some questions on SO ( here and here ) as well as other sources I've lost track of. I realise there's plenty out there but somehow I am still having difficulties. I'm currently trying to implement the most basic test, to confirm I've compiled/installed

How to properly setup googleTest on OS X aside from XCode

半腔热情 提交于 2019-11-26 22:58:43
问题 How do I setup gTest, so that I can link aganist the library? I will code in vim, so I just want to install the libraries, unlike the XCode setup. Goal is to be able to link a project against the library by setting -lgtest as linker flag and optionally, if I did not write my own test mainroutine, the explicit -lgtest_main flag. 回答1: Before you start make sure your have read and understood this note from Google! This tutorial makes using gtest easy, but may introduce nasty bugs. 1. Get the

How to test an EXE with Google Test?

梦想的初衷 提交于 2019-11-26 22:23:09
问题 I have a C++ project in Visual Studio, and have added another project exclusively for testing. Both of these projects are EXEs (console apps). So how do I use the first project inside the second? Just to clarify, the question here would be somewhat self-evident if the first project was a library that one could simply include in the second project but, being an EXE, this is where the problem lies. 回答1: Per your comments, you have a C++ console application ( MyApp) for which you have developed