New MXUnit Ant Automation Video

Tuesday, March 25, 2008

We wanted an efficient way while building MXUnit (and other projects) to frequently update local working code from the repository, run unit tests, and commit the changes back. This should be fast and the commit should only happen if all source code conflicts are resolved and especially if all tests pass. It's very simple to implement and it may very well be one of the most useful implementations of the ant task we have to date. Check it out ... and forgive my total lack of ability to speak at God awful early hours before real work. http://mxunit.org/doc/video/mxunit_ant_automation_demo.html Let me know if there's any annoying browser problems - I'm new to this software demo stuff. thanks, bill

Using CFCProxy inside CF to call a CFC via file path

Friday, March 21, 2008

One of the main goals with MXUnit is that you can download it and run it from any location accessible by ColdFusion with as little configuration as possible - hopefully none at all. The main issue is that we needed a way to determine where MXUnit is installed in the target environment. Starting in CF6 you can get a wealth of information about a CFC by invoking getMetaData(theCfc). The problem is you need to specify a reference to that component as the server sees it; i.e., com.foo.bar.MyComponent. We know our product well and it's structure is stable. The idea of using the meta data from the MXunit installation seems logical, but in order to do this we need to use a relative path to a known CFC, instantiate that, get its meta data, and infer where MXUnit is installed. Enter CFCProxy ... This is a java class that was apparently shipped with CFMX 7 updater 1?, but the only documentation *I* found was at Ben Forta's site: http://www.forta.com/misc/cfcproxy.htm It looks like the intention of this was aimed at providing the ability of servlets and other Java classes to collaborate with CFCs. And as we now know, it's quite simple to instantiate java classes inside CF and execute their methods. With CFCProxy, the constructor accepts a file path to the CFC and returns a proxy object. This proxy object is used to to call methods on the CFC. This is how it works : <cfscript> // @pre path to framework/ComponentUtils is static //the pwd context = getDirectoryFromPath(getCurrentTemplatePath()); //init() calls the constructor that accepts the path to a cfc proxy = CreateObject("java", "coldfusion.cfc.CFCProxy").init("#context#framework/ComponentUtils.cfc"); //if your page prints anything, make sure you tell the proxy not to do any writes proxy.setAutoFlush(false); //proxy.invoke() expects an array of objects ... Object[] args = arrayNew(1); //the proxy returns a reference to the CFC as a struct componentUtils = structNew(); //instantiating the component ... ComponentUtils is *our* contstructor that //returns an instance of the cfc. componentUtils = proxy.invoke("ComponentUtils",args); //Now that we have an instance, we can get at it's meta data componentUtilsName = getMetaData(componentUtils).name; //We also use this object to infer path information componentRoot = componentUtils.getComponentRoot(componentUtilsName); ... </cfscript> For details on getInstallRoot() and getComponentRoot(), download MXunit and browse to mxunit/framewor/ComponentUtils.cfc. Special thanks to Adam Haskel for the J2EE information on getPageContext().getRequest().getContextPath()! -bill

a few small plugin updates

Friday, March 14, 2008

The other night I released a new version of the mxunit eclipse plugin. This fixes two bugs in the "stack trace" table at the bottom of the plugin. Bug 1: if you click on the name of a failed test, it goes to line 1 instead of the point of failure. This actually wasn't so much of a bug as a feature i never implemented fully. now it works like i always wanted it to work. Bug 2: if you click on a "white space" line in the trace table, you get an eclipse error. Actually... you probably never noticed the error... it just goes silently to the eclipse error log. But i fixed that anyway. One other thing: I added the help instructions for setting up the cfsnippets.org snippets into the integrated eclipse help. This shows you how to get the cfsnippets.org snipex server set up. There are a handful of useful mxunit snippets on there. marc, out.

If you're as cheap as I am, this might matter to you


WebManiacs, which is shaping up to be quite a packed venue, ends its early bird pricing today. Here's the math: sign up for cfmaniacs now, save 100 bucks sign up for flexmaniacs now, save 150 bucks. sign up for both, save 150 bucks Here's the consequence of said math, in Marc's world: 100 bucks = 2 bottles of Dalwhinnie 15 + 4 Arturo Fuentes 100 bucks = 2 cases Weyerbacher Big Bears + 1 box Gisperts 100 bucks = @9 DogfishHead 120-minute IPA bottles oh. yeah. 100 bucks = lots of new toys for my beautiful children. (in case the wife's reading this). 150 bucks = all of the above plus a steak at one of DC's many great steakhouses 150 bucks = all of the above plus dozens of wings for you and all the peeps you'll meet at WebManiacs and so on... See here for all you get

CFEclipse dictionary generator

Monday, March 10, 2008

Some time ago I started working on a generic cfeclipse dictionary generator. But, as things go, it got put on the backburner, then the way backburner. The thing is, I think this is one of those things you can get maybe 60-70% right, if that, with using just the information available to you with getMetadata() with the default attributes on tags. To get the rest, you either have to add it in after the fact or go with something like custom attributes, or maybe annotations in comments, or some other such thing. I prefer custom attributes myself. Now, me, i don't want to add in the rest by hand, because then you lose any ability to autogenerate documentation as part of build processes, etc., which is quite appealing to me. So I'm wondering: has anyone out there in the community built such a tool?

MXUnit Eclipse plugin updates


I released a new version of the mxunit eclipse plugin yesterday. The new features are:
  • progress bar enhancement
  • cfdump javascript should now work
details for the truly bored or curious are here and here --marc

MXUnit - New Install Video

Saturday, March 1, 2008

We're geekin' out here at MXUnit.org! And for those who like to watch before you try, we got it. We're making low quality/high value software video demos with audio for our tutorials. The first one, How to Install the MXUnit Framework, is available for ridicule at: http://mxunit.org/doc/video/mxunit-install3.html Comments always welcome! bill