Discussion:
Unit tests for COM Components coded in c++
(too old to reply)
Alessandro Riolo
2009-08-13 10:18:26 UTC
Permalink
Dears all,

I am looking to understand which unit test framework could be the
better choice to write unit tests for some COM Components written in c+
+.
I am currently using VS 2008 sp1, win32 and x64.

Thanks to Google I quickly found out those lists:

http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#C.2B.2B
http://www.opensourcetesting.org/unit_c.php

Does anyone has got any experience or suggestion to share about this?

Thank you anyway,

--
ale
http://ale.riolo.co.uk
Ulrich Eckhardt
2009-08-13 10:36:53 UTC
Permalink
Post by Alessandro Riolo
I am looking to understand which unit test framework could be the
better choice to write unit tests for some COM Components written in c++.
I'm testing some C++ (but not COM) components using a Python wrapper. Since
COM provides a language-agnostic interface with bindings for many languages
you don't have to write unit tests in C++ or use a C++ unit testing
framework.

Sorry for doing the exact opposite than narrowing your choices, but I
personally think that an agile scripting language is better suited to
writing unit tests.

Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
Alessandro Riolo
2009-08-13 12:21:03 UTC
Permalink
Sorry for doing the exact opposite than narrowing your choices ..
No need to be sorry, that was food for my though, I hadn't thought
about that possibility.

I don't know if it will lead anywhere, but I have to thank you
anyway :)

--
ale
http://ale.riolo.co.uk
mzdude
2009-08-13 13:32:37 UTC
Permalink
Post by Alessandro Riolo
Dears all,
I am looking to understand which unit test framework could be the
better choice to write unit tests for some COM Components written in c+
+.
I am currently using VS 2008 sp1, win32 and x64.
Boost has a unit test framework. We use that occassionally. Seems to
do the job.

I've also used Python to test the COM interface. Works pretty well
unless
the COM interface supports events. Still haven't figured that one out
in Python.
Tamas Demjen
2009-08-13 21:48:18 UTC
Permalink
Post by Alessandro Riolo
I am looking to understand which unit test framework could be the
better choice to write unit tests for some COM Components written in c+
+.
I'm using NUnit to test my COM objects. That's the .NET port of the
popular JUnit framework. It has a very clean design, and takes full
advantage of .NET attributes. It's easier for me to use COM from C# than
from C++, and our customers work in .NET as well. I can put together
tests very quickly this way. For testing COM objects C++ would not be my
first choice.

On the other hand, I've discovered reference counting related bugs
easier in C++. The COM .NET interop is garbage collection based, and is
therefore very much unpredictable. For example, an access violation on
object deletion can be delayed significantly (until the next garbage
collection), which makes debugging very difficult. On the other hand, it
runs 100% consistently from C++. But for a high-level system tests, C#
or a scripting language is easier.

If you want to unit test the low-level C++ functions underneath the COM
wrapper, you could try the Boost Test Library. I'm not sure how the
other C++ frameworks compare to that.

Tom

Loading...