An Architect's View

CFML, Clojure, Software Design, Frameworks and more...

An Architect's View

cfcUnit Facade for CFUnit Plugin

April 20, 2007 · 8 Comments

I've posted the facade CFC that lets you use cfcUnit with the CFUnit plugin for CFEclipse to the 'SOFTWARE' pod on my blog. First, if you haven't already done so, install cfcUnit. Second, if you haven't already done so, you need to install the new CFUnit plugin. In Eclipse, Help > Software Updates > Find and Install... and search for new features on the CFEclipse update site. You should see a CFUnit 1.0.4 plugin. Install that and restart your workspace. Third, download my facade CFC and put it somewhere that is web accessible (I put mine in my webroot). Then configure the CFUnit plugin to use that location, under Window > Preferences > CFEclipse > CFUnit. Specify the URL to the directory containing the CFEclipseFacade.cfc you just downloaded. Finally, open the CFUnit view (Window > Show View > Other and select it from the CFML section). Now you can enter a CFC path - or search for CFCs - and run them directly in Eclipse.

Tags: cfeclipse · coldfusion · tdd

8 responses so far ↓

  • 1 Andrew Powell // Apr 23, 2007 at 5:29 AM

    I'm not sure if I prefer this or the automated testing with an Ant build. I like the output from this method, but I like the automation of the Ant task.
  • 2 Matt Williams // Apr 23, 2007 at 6:31 AM

    Hey Sean, I could very well have something wrong on my end, but I didn't get any feedback in the CFUnit tab in Eclipse. The test runs in CFCUnit with one intentional failure. Entering the same path to the same cfc doesn't seem to do anything.

    I have never used CFUnit or the plugin before. What sort of feedback should I expect? Does the version of CFC unit matter? It has probably been a while since I updated it.

    Thanks,
  • 3 Sean Corfield // Apr 23, 2007 at 11:22 AM

    @Andrew, I think both have their place. I like running full test suites via ant but I also like being able to quickly run a single test within Eclipse as I am working on a specific test or class. Right now the facade for the CFUnit plugin does not handle test suite classes, only test case classes. That's something I need to add. I also need to make it smarter about finding CFCs.

    @Matt, hard to say what's wrong. If it was running correctly, you'd see green, orange or red output and the number of tests run, failed, error'd out. Did you set the CFUnit URL to the correct place? It should be the URL of the CFEclipseFacade.cfc but without the actual filename (so it's the URL of a directory). The CFC path you enter in the test panel should be the dot-separated name of the CFC you want to run and it must be a TestCase. Try org.cfcunit.samples.SimpleTest (a test provided with cfcUnit). I get 3 tests run, 2 failures, 1 error and in the tree view below I get "org.cfcunit.samples.SimpleTest (0/2/1)" in red and if I expand that node, I get "testEquals (Failure)" and "testAdd (Failure)" both in orange and then "testDivideByZero (Error)" in red.
  • 4 Matt Williams // Apr 23, 2007 at 11:56 AM

    Thanks Sean, I had fat fingered the url for the facade. I'm getting the same results on the SimpleTest.
  • 5 Andrew Scott // Apr 25, 2007 at 8:22 PM

    Doesnt work for me either.

    Installed the facade, its browseable from a browser so thats not a problem. Have added a mapping for org to load CFCUnit. So what else could be wrong?

    Also been getting a lot of view errors, when closing the view and readding the view.
  • 6 Sean Corfield // Apr 25, 2007 at 9:58 PM

    @Andrew, hard to tell from that limited information. Have you ensured that you can run the cfcUnit test harness and get the correct results? Are you sure you have the right URL in the CFUnit preferences? Are you sure you entered the correct CFC path in the CFUnit plugin panel?

    It works for me and it works for Matt, once he got the correct URL configured. Catch me on IM and I'll walk you through it with Acrobat Connect if you want...
  • 7 Andrew Scott // Jun 18, 2007 at 11:12 PM

    @Sean - I eventually got it to work. It must have been working all the time. Just not with test suites, well at least not mine anyway.
  • 8 Sean Corfield // Jun 18, 2007 at 11:27 PM

    @Andrew, cool, glad to hear it! Certainly the first version I posted did not support test suites. Download it again and see if the updated version helps. I remember adding suite support at some point... I just can't remember when, sorry :(

Leave a Comment

Leave this field empty: