We should select tool for our C++ code.
Is there a same tool or the tools of the same company for unit test framework
and code coverage tests?
Our aim if the both tool can work compatibly.
Sorry for my english
Thank you very much
For code coverage you can use the lcov tool and as Unit test Framework you can take a look at the Boost library
I used both CxxTest and GoogleTest and both do the job, with a main difference that the former is using pre-build script to generate the test driver code and the later uses static registration of tests which the driver later uses.
For coverage under Windows Bullseye Cover is a great product.
Related
I need to take the code coverage of my product code.
We use cppunit for unit testing. The complete code is in cpp.
Compilation of code takes place using make files.
Is there any way to take the code coverage using cppunit?
We do not use linux.
We use Keil for debugging and eclipse for code browsing.
CppUnit is not a code coverage tool. But it isn't incompatible with code coverage tools. So the answer is, you'd measure code coverage as with any other application. With Keil, you either need to be running in the simulator, or capture an instruction trace from your device using device-specific tools. Then you'd just load the trace into Keil's coverage analyzer.
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
We have a project using C#, C++/Cli and some native C++ code. We use TeamCity for building and testing.
We run the tests using vstest.console (VS2012 test runner).
For managed code, dotCover (which is integrated into TeamCity) is used for code coverage. However, it doesn't work with native C++ code (which is to be expected).
How do I get code coverage results our unit tests for the native C++ parts into TeamCity? Ideally, the solution would be free.
We use Bullseye Coverage for C++ code coverage. We then use the provided covxml tool to convert the binary coverage files into an XML file, which we then read out a bunch of useful attributes for function and conditional coverage (e.g. fn_total, fn_cov, cd_total, cd_cov) and provide these to TeamCity via the statistics service messages using the predefined coverage keys.
It was a bit of work to set up, but I think TeamCity still has no support for any C++ coverage tool, so our solution still works well for us years later.
Edit: I've uploaded the XML parsing code for our in-house tool to a Gist.
we have a huge codebase with about 1000k lines of native/unmanaged legacy c++ - code and we are going to provide the code with unit tests and MSTest would fit perfectly in our current development environment (TFS, VS 2010, ...). I know that MSTest is orginally meant to test managed code but its also possible to write unit tests for unmanaged sc.
Are there any (later) drawbacks on the usage of MSTest for unmanaged code? Does anyone have any experience on this?
The second opinion would be using Google.Test, but I would have to write a Visual Studio add-in to integrate the gtest framework in our environment.
Thanks in advance!
I would not recommend MSTest for managed testing. See here for my experiences. However if you do insist I would say a really good way to test you legacy code would be use PInvoke interop to your c++ code.
I would recommend googletest anyway. I think they will also gladly accept your VS integration and include it in the next release, provided the patch has reasonable quality.
Oh, and you can use another great Google project then, gmock.
I use the Boost.Test framework to test my C++ code in Visual Studio without any issues. You need to create a test project (a console-mode EXE) that contains your tests which your main project can depend on. Using the Visual Studio 'post build' step you can run the tests automatically.
I'm using Mobile JUnit, released by Sony Ericsson for unit testing for my J2ME project. I read in the documentation that one can run the tests under regular junit with the help of a few wrapper classes. The documentation, in fact, recommends that you do this if you want to generate reports for CI builds, etc. which is exactly what I want.
Unfortunately, the documentation is a little terse on how to do this. Has anyone had any luck with this aspect of Mobile JUnit?
What I did (and I'm not saying this is necessarily a good idea in general, but it worked in my specific case) was to separate the the code base into a library and the UI. The library didn't include an J2ME specific stuff in it and it didn't include anything that J2SE had the J2ME didn't. As a result, you could check it out in NetBeans as a J2SE project and it would compile. Then I wrote JUnit tests in the J2SE context. This doesn't help test the UI, but it made it very easy to test the library.
It sounds like you found a more complete solution that tests both. Can you elaborate on what microemulator you used?