SWX Batch mode Integrated Tests with CEEFIT
If you have read any of my previous posts on Testing CAD Plugins, then you are aware of what I am trying to accomplish - an automated Integrated Test framework to test, at the very least, SolidWorks API Plugins. The following are some of the more relevant posts regarding Testing CAD Plugins:
- SolidWorks API - In-process or Global methods - Which to use?
- Writing CEEFIT class like a regular C++ class
- Batch mode SolidWorks
- Batch mode Pro/Engineer
- MbUnit + AutoCAD = Unit testing for CAD Plugins
http://ossandcad.googlecode.com/files/swbatch.zip
If you prefer to download from the source, you can do so using the following link with your SVN client (e.g. TortoiseSVN (follow the instructions at http://code.google.com/p/ossandcad/source/checkout)):
https://ossandcad.googlecode.com/svn/trunk/swbatch
The Pursuit of "CAD Plugin Testingness"
With this post I continue my pursuit of an automated Integrated Test Framework, using CEEFIT and dare I say it, I have come quite close to achieving my goal (my wishlist of sub-goals not yet achieved are listed at the end of this post).
Download the IntegratedTests workspace
You can choose the zip format or access from SVN directly:
https://ossandcad.googlecode.com/svn/trunk/swxbatch_ceefit
The "swxbatch_ceefit" workspace is an extension of the "swxbatch" workspace. The main difference is the ability to load SolidWorks and using API and CEEFIT, pass it input from the CEEFIT tables and verify expected output as mentioned in the CEEFIT tables.
The solution is documented - but its my contention that nothing is ever documented enough - so if you need more information on how things work then leave a comment. I will put up another post that has more details.
Assumptions:
- You have SolidWorks installed and are working with appropriate licenses
- You may need to have the SolidWorks API SDK installed to write SolidWorks API-based code.
- You have access to Visual Studio (at least 2005, as this solution is provided in that version). Later versions should work but I have not tested them out.
- Passing in only HTML file (with CEEFIT tables) at a time is supported. This is how CEEFIT works by default, but it is not easy to test CAD stuff with all data in one single table. I wish for a solution to this and will post if I am successful. But for now it works as intended.
- Currently integration of CEEFIT-based solutions with Continuous Integration systems (e.g. CruiseControl.NET) is poor, as CEEFIT only puts out HTML files and at least CruiseControl.NET does not merge HTML output as part of its build log, which is a bummer as "true" integration would help us identify a failure, location and cause, which this current framework does not do. I wish to write out the output of CEEFIT as XML (at least) so that it can be integrated into build systems. (To be honest, FIT and thereby CEEFIT profess to be tools that enhances customer interaction with systems in development, so HTML works best, but for developers HTML is difficult to incorporate into their workflow).
- The provided workspace is good only for SolidWorks. I wish for a solution that allows interaction with various CAD systems, through their individual API, and tests my plugin application with all of them.
- The workspace, when run, starts SolidWorks in background (aka batch mode) by using a SolidWorks API, which simply hides the SolidWorks window.
swApp->put_Visible(FALSE)
- If you want to make SolidWorks visible during its batch operations, then change the FALSE to TRUE and rerun. SolidWorks starts up and you can see all API actions play out like a movie. I should say it is almost as fun to watch as a video on Youtube.
- I have used a global variable "swApp" as I don't know how else to pass variables in to the CEEFIT run test classes. While not a big problem, I hate global variables as they make testing otherwise hard to do.
- Please visit the home page for this and other projects: http://ossandcad.googlecode.com for more information. I will try to update those pages soon and as regularly as possible.
- For more information on CEEFIT you can read the short summary I have at http://ossandcad.blogspot.com/2008/05/protoolkit-solidworks-api-development.html or even visit the CEEFIT homepage at http://ceefit.woldrich.com/?page=Home. I should warn though that CEEFIT has not been updated for many years, but it works relatively well in its current stage. Hopefully enough of us use it to get the original author dave@woldrich.com to continue development.