This is a blog about testing and JSF. But mostly, it's about JSFUnit, the new JSF testing framework from JBoss.

Thursday, October 2, 2008

JSFUnit the Easy Way!!

JSFUnit tests are easy to write and understand. This comes across clearly whenever I talk about it at a conference and I see faces light up. They "get it". However, it's also clear that the hardest part of JSFUnit is getting started. Once you get over that hump, developers really like the tool. But until now, setting up JSFUnit for the first time required quite a bit of work.

This is all made possible because of the redesigned microcontainer of JBoss AS 5. You can take an ordinary WAR and add servlets, filters, and classes on the fly as it is being deployed. I've been wanting this kind of functionality for as long as I can remember. It's perfect for adding test tools, fixtures, or monitoring. Before now you had to bundle this stuff with the application - stuff that really doesn't belong in your WAR.

The interesting part is that now instead of thinking of a WAR or EAR as "my application", we can truly think of it as a reuseable deployment unit. It's just another component that can be decorated or combined with other components. While this view provokes a lot of questions (security, name collisions, etc.), the mind reels with the possibilities that this represents.

For those of you watching this discussion, Ales is the one who wrote a lot of this deployer stuff.

I fixed #1.

For #2, I think only the comment is wrong. While it's not technically a directory, it is a directory in the virtual (VFS) sense, right? Anyhow, I believe this is what I want because I want to add any file/directory specified, plus any descendant.

For #3, I don't understand at all. Obviously, I'm missing something about how all this works.

About Me

I've been working for JBoss/Red Hat for several years. During most of that time I've worked on JSF. Lately, I've worked a lot with the new AS7 management model, creating the CLI GUI and the new CLI Resolver. This blog is here to share tips on AS7 management.