unit test in c++ [duplicate] - c++

This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
C++ testing framework: recommendation sought
C++ unit testing framework
Hello,
which unit test framework do you recommend for c++ ?
Thanks

In the past I was using CppUnit(http://sourceforge.net/apps/mediawiki/cppunit/index.php?title=Main_Page), but now I prefer the Boost test library (http://www.boost.org/doc/libs/1_46_0/libs/test/doc/html/index.html).
Lately I also use QTest (part of the Qt framework) also for my non-Qt projects (http://qt.nokia.com/products/)

google test http://code.google.com/p/googletest/

Unittest++ : http://unittest-cpp.sourceforge.net/

See this,
http://www.boost.org/doc/libs/1_34_0/libs/test/doc/index.html
Boost Test Library

Related

Mocking in Universal Windows Platform app tests [duplicate]

This question already has answers here:
Mocking framework in UWP Apps [closed]
(2 answers)
Closed 6 years ago.
I'm creating a library for Universal Windows Platform apps ("Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" under dependencies and "uap10.0": {} under frameworks in project.json). I just started writing tests, but I can't seem to find any mocking library which would support the Universal Windows Platform apps. The only one is MoqaLate, but it's very new and severely limited.
I can't see myself testing without mocks, but I'm also new to UWP development. Am I missing something, or it really is impossible to use mocks in my tests? If so, what are alternatives?
Edit: One alternative I see is to develop Windows Class Library (Portable) which would target only Windows Universal 10.0. Is there any gotcha with this approach I should be careful about? My goal is to have a library that can be used in Windows 10 apps (on mobile, desktop and xbox).
Windows 10 uses .NET native to compile release builds down to machine code, so you are no longer working with MSIL and therefore the techniques used by mocking frameworks (IL weaving etc) cannot be used.
However, in debug mode your Windows 10 app runs standard .NET IL (for faster build / debugging cycles) so any mocking framework should work in debug mode as long as you only use it in a PCL project.

Getting started with unit testing for c++ in eclipse on Ubuntu

I've recently switched to an Ubuntu os where I'm working on an important c++ project. I am using eclipse as an IDE and I was wandering what is the best way to do unit testing considering I've never done any unit testing.
Links for tutorials would be most appreciated.
I used google test for unit testing my project which is C++ based. It is easy to set up and use. Please check the below link.
http://www.codeproject.com/Articles/811934/Cplusplus-unit-test-start-guide-how-to-set-up-Goog

UnitTesting for mixed C++/Cli projects

Which UnitTest framework should I use to test mixed C++ code (native and C++/CLI)? Any HowTo's or Tutorials?
Thx
You can use NUnit to test both very easily. If you write the tests in C++/CLI you will be able to test the native code too.
See here for a related discussion.

Learning Qt by example [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Qt tutorials for beginners
What resources for learning Qt by example do you recommend?
Thanks.
If you install the Qt SDK, Qt Creator will have a comprehensive and structured list of examples right when you start it, selectable from a menu.
C++ GUI Programming with Qt4

Testing with Visual Studio Test 2010

Does any one know if I can test native code in VS Test 2010?
you can find here an interesting way to do it.
Apparently not according to the docs here.
You cannot have test projects with
unit tests that use unmanaged C++.
This is confirmed by MSFT here.
There was another question here on the stack that I can't find, but it linked me off to
How Do I: Create and Run Unit Tests in Visual C++?
This shows that you can unit test native code including C++ but to do so you would still write the unit tests in managed code.
I have not tried this in person, and one thing I noticed was the demo used the COM interface to test the C++ native code, so have no specific experience of using C++ classes more directly in the unit test.