Monday, May 05, 2008

Pro/Toolkit, SolidWorks API Development Tools (C++ Episode)

Continuing the topic I started discussing in my last post with Visual C++ and Pro/Toolkit development tools.

Remember you can use TortoiseSVN with any file type (does better with text, since merging is possible with text files), so I don't mention it separately here.


Visual C++
Logging Tools:
Pantheios
Logging in Visual C++ is unfortunately not the easiest tool to find. There are many that pop up e.g. Log4Cpp, Log4Cplus, log4cxx etc. but I was not able to build any of these successfully. So I finally turned to Pantheios and found it as easy to use as NLog though the configuration is quite different and is not done through configuration files like NLog. You have to build the Pantheios libraries yourself, so don't forget to refer to the Pantheios Library Selector Tool to make sure you use the right libraries with your code.

Now keep in mind that Pantheios describes itself as a logging API rather than a logging tool meaning it does not have the choice of targets that NLog provides (of course there is no NLog for pure C++, only in mixed managed/native mode). So Pantheios allows you to write to files on your hard disk and thats it. For more target choices you need to add one of the previously mentioned logging tools (viz. log4cpp, log4cplus or log4cxx) into the mix. But I have found no need to do so. I use the stock back and front ends that come with Pantheios and write my log messages to a file on the hard disk.

Pantheios uses a BSD-style license.

Testing Tools
CppUnit
CppUnit is probably the most well known unit testing frameworks available for C++. CppUnit is licensed under the GPL. I have found it easy to setup and use even though you need a few macro statements to write even an empty unit test. For a thorough review of the unit tests available I refer you to a post by Noel Llopis posted a few years ago (2004) but still very relevant. After reading Noel's post I stuck with CppUnit as it offers most C++-like experience which most developers programming Pro/Toolkit are comfortable with, though I would love to have some time to study Boost.Test since I love the Boost libraries.

CeeFIT

I mentioned FIT with my last post and CeeFIT is the C++ implementation of FIT. The following is just an excerpt from my previous post and is just as relevant in this section:

FIT stands for "Framework for Integrated Test" and enables developers to place the input data in HTML tables so that it is easy to read (both by Human users and software) and outputs the resulting data back in that same HTML table (with a different file name if you prefer) with colored markup so that it is easy to tell which test passed and which did not. FIT is described as a collaboration tool and I have successfully used it as such, by using those HTML files to contain complete descriptions of functionality of the application being developed and to show current status of development. Make sure you download the right version of the FIT libraries as it comes in various flavors e.g. Java, C++, .NET etc.

I am unaware of other integrated test tools that are as simple to use as FIT and are Open Source or at the very least free to download and use for personal applications. If you know of any please let me know.
Database
SQLite
I mentioned SQLite also in my last post as an excellent, completely free and easy to use database engine. To use SQLite with C++ you need to use a wrapper and many are listed at SQLite's wrapper page. I have personally used CppSQLite hosted on CodeProject and found it really easy to work with.

NOTE on Using CppUnit and CeeFIT with Pro/Toolkit applications
Keep in mind that using CppUnit with Pro/Toolkit applications would require you to run Pro/Engineer in batch mode, which I would definitely advise against as that would slow down your build process and does not quite fit in the realm of unit tests. So you are better off writing functional or integrated tests for your Pro/Toolkit applications.

To write integrated tests for your Pro/Toolkit application using CeeFIT remain tuned in to my blog. I am working on a workspace that will let you do just that and will post the code if and when I am successful.

Comments or suggestions?

5 comments:

  1. You mentioned subversion and solidworks, but how do you integrate the two? How would you automagically insert the svn version in revision fields in SW?

    ReplyDelete
  2. Hello Charles,
    Thanks for the comment. I mentioned Subversion and SolidWorks limited to software development. At the company I work for we do use SolidWorks and Subversion to keep track of versions but do not have any customization in place to automagically insert the SVN version in the revision fields in SW. Sorry. I guess I should explain that better in my post.

    While theoretically we could use OLE/COM to run SolidWorks in the background (http://ossandcad.blogspot.com/2008/04/batch-mode-solidworks.html) to read/write/insert values in the SolidWorks it is not something I have specifically dealt with.

    ReplyDelete
  3. I have heard about the Visual C++ that People make fewer mistakes in consistent environments, Programmers can go into any code and figure out what's going on, People new to C++ are spared the need to develop a personal style and defend it to the death, People new to C++ are spared making the same mistakes over and over again, Programmers have a common enemy.

    collagen

    ReplyDelete
  4. Hi collagen,
    Thanks (I guess) for your comment though I don't know what to do with it. I don't want to mark it as spam but not sure if you had an intention when posting it.

    ReplyDelete
  5. Hi Ganesh,

    Nice informative blog , especially for ProToolkit developers. I stuck in a situation and it has relation with logging information you have provided here. That I would like to discuss. I had run into failures to register my ProToolkit DLL if project generating this DLL has reference to the LOG4CXX log file. Have you ever encountered any of such situation. I feel issue is with compatibility conflict between ProToolkit DLL and LOG4CXX lib. Let me know your experience/thoughts on this.

    ReplyDelete