Login

    Register

PROJECT CATEGORIES

 

RocketUnit
Project Home Forums Wiki Known Issues Screenshots External Project Link Contact Project

Author: Robin Hilliard (All RIAForge projects by this author)
Last Updated: April 13, 2008 10:57 PM
Version: 1.0
Views: 2745
Downloads: 129
License: GPL (GNU General Public License)

Description:

-----------------------------

RocketUnit is absolutely sweet; thx for publishing it, Robin. Compared with both CFUnit and CFCUnit it's a no brainer to setup, it's much simpler to use and still delivers the same (over even better) information. Even people who never have worked with unit testing before can actually get it pretty much straight away.

- Kai Koenig


-----------------------------

I'd just like to publicly thank RocketUnit for finding this for me the moment we upgraded our dev server here. I encourage everyone who isn't actively unit testing to have a look at RocketUnit or any other unit testing framework as they will saves you a lot of heartache. It takes about 5 minutes to get your first test running, and after that you'll be streets ahead.

- Phil Haeusler

-----------------------------

I have to confess, I have been using RocketUnit for a while now and it is just perfect! So nice and simple and easy to use, we even have developers using it for unit testing some of our C# webservices!! (ok ok, maybe that is just me)

- Lucas Sherwood


-----------------------------


RocketUnit is a unit testing framework for ColdFusion. What? I hear you say, Not another one! Well yes, but this one is a bit different:

* It is small - a single CFC.
* It has one assert() function, not tens, but still gives detailed, meaningful messages when assertions fail.

Together, the above features make RocketUnit pretty approachable and easy to use. A few of our clients have been successfully using RocketUnit to test anything from a single custom tag up to a complex payment gateway.

Here's a head-first guide to getting up and running with RocketUnit:

1. Expand RocketUnit into your web root. This will create two folders, /com and /test. *
2. Browse {your site}/com/rocketboots/rocketunit/rocketunittests/ to confirm that RocketUnit is installed.
3. Browse {your site}/test/com/rocketboots/sample/ to see the sample test case output. Note the verbose explanation when the test fails.
4. Open /test/com/rocketboots/sample/index.cfm to see how the test was invoked.
5. Open /test/com/rocketboots/sample/TestSample.cfc to see what a RocketUnit test case looks like. There are plenty of comments to explain what is going on. Note that all the test cases use either assert() or fail() to record test results.
6. Read the header comments in /com/rocketboots/rocketunit/Test.cfc for a more general usage guide.
7. To make your own test case, copy index.cfm and TestSample.cfc to use as a starting point**. Here's a simple checklist for the tests you might want to create:
* Normal processing - typical inputs produce expected outputs (for each method if testing a cfc).
* Boundary processing - if there are loops in the code, what happens if you pass empty or very large arrays, queries or collections as input?
* Abnormal processing - does the code being tested detect invalid or missing arguments and throw the appropriate exceptions or use the correct defaults?
8. Note that you can create your test cases before you create your code if you like - all that will happen is that you'll get failures or errors coming up in the report. The objective of subsequent development then becomes to make the test cases pass successfully. This is called Test Driven Development and is widely regarded as a Good Thing. That said it's also a good idea to create test cases for legacy code, particularly if you're about to embark on some refactoring fixes and you want to make sure you aren't breaking anything.
9. When you discover a bug in your code, the first thing to do is write a test case that reproduces the bug. Then you fix the bug and check to see the test passes. In this way you make sure that no-one can reintroduce the bug without causing a test to fail.

* I love keeping my code in packages outside the webroot. To make it easy for you to deploy RocketUnit the instructions say to expand it in the webroot, taking advantage of the implicit "/" cf mapping that points to the webroot. Feel free to rearrange the code under CF mappings - as long as com.rocketboots.* and test.com.rocketboots.* are mapped the code will work if you copy the index.cfm files to somewhere you can browse.

** It is standard practice to keep your test cases in a package structure starting with "test", which then shadows the original package structure of the software being tested. However you do not need to follow this practice to use RocketUnit.

If you have any questions about using RocketUnit please post them on the RocketUnit Google Group and I'll answer them as soon as I can.

Requirements:

ColdFusion MX

Issue Tracker:

There are no issues for this project.

To enter issues for this (or any other) project, you must be logged in.