Wednesday, December 23, 2009

What's a WARlet ???

JSFSpy Progress
Today I uploaded a new snapshot of JSFSpy. BTW, I'm keeping the name JSFSpy. Even though I don't like it that much, it's short and to the point. Thanks to those who had other suggestions earlier this year. JSFSpy is super-easy to install. Just drop the JSFSpy core jar into your WEB-INF/lib and you are ready to go. Click here for details.

What's a WARlet ???
In short, a WARlet is a WAR plug-in. It provides one or more Facelet views via a WARlet container and some Servlet 3/JSF 2 magic. A WARlet is neatly packaged in its own jar. The jar contains any xhtml, css, images, and classes that it needs. This provides a module of UI and processing logic that you can add to your WAR with zero configuration.

If you happened to catch my JSFSpy presentation at JSF Summit a couple of weeks ago, you saw a WARlet in action. I'll re-create that demo here. Notice the JSFSpy menu buttons at the top:

I took JSFSpy and bundled the WARlet container along with it. Then I took my EL_Evaluator WARlet jar and dropped that into WEB-INF/lib. Redeploy and Viola!! Now an EL Evaluator button appears in my application on the far right.

The button can launch the EL Evaluator functionality. Here is the EL Evaluator:

So how does the button get added? JSFSpy doesn't know anything about EL Evaluator. It only knows that one or more WARlets might be present. So the button menu has this markup to display a launch button for any WARlets that happen to be there:

So what this all means is that anyone in open-source land can create their own WARlet that plugs into JSFSpy. I'll be posting more about how to create a WARlet in the near future. If you just can't wait to write your own you can browse the JSFSpy source, example code, and WARlet container source.

The only catch is that all this requires Servlet 3.0 and JSF 2.0. Nothing wrong with the bleeding edge, eh?

So long, thanks for all the fish, and have a great holiday!


Saturday, August 29, 2009

JSFUnit Podcast on JSFCentral

Kito Mann just posted a podcast of yours truly on JSFCentral. It was recorded at a JSF Conference almost a year ago when JSFUnit was still in beta. But you might still find it interesting:

I'll be speaking at the conference again this year in Orlando. Hope to see you there.

So long and thanks for all the fish,


Thursday, July 16, 2009

JSFUnit 1.1.0.GA is released

The latest JSFUnit release is now out. This is primarily a bug-fix release, with several of these fixes related to Seam. The only significant new feature is the ability to parameterize your tests.

We now recommend using HtmlUnit 2.5 instead of 2.4. Also, everything is updated to the latest beta version of JSF 2. So now you can use JSFUnit with JSF 1.1, JSF 1.2, and JSF 2.0 Beta 2.

As for JSF Spy (JSF Eye?), this is not ready for a release. It will probably become its own separate project soon.

So long, and thanks for all the fish,


Friday, June 5, 2009

Help Me Name My Baby

I've got a new baby and I don't know what to name it. It's a new JSF debug/trace/performance tool. If you've ever seen the Facelets or Seam debug page then you've got an idea of what it is. However, this tool goes beyond those to take "state snaps" before and after each phase. And, it keeps all the info from every request and every session, even expired sessions.

Pre-alpha documentation and download is here.

So now you can debug those nasty AJAX components that do four or five JSF requests with every mouse click. You see all the HttpServletRequest data like params, headers, and cookies. And, you can look at the performance data for each request and each phase.

For now, we store this info in memory for you to peruse at your leisure. Later, I'll probably look at other options like saving to a database. That way, it might be a fit tool for production auditing.

So right now you are either thinking this is really cool or really nuts. Judge for yourself, and let me know. And if you have a good name for it please let me know that too. Right now I'm calling it JSFSpy, but I really don't like that name.

There is no dependency on JSFUnit. Installation just requires dropping a single jar into the WEB-INF/lib of your application. But you can do assertions on the collected data from JSFUnit or you can just browse it with the UI. If you want to use the UI, you'll need to put some xhtml files in your web app. Instructions are here.

Here are the screen shots that should tell you exactly what it does. There's more stuff to add like Seam scopes, JSF2 scopes, component tree, and FacesMessages. What do you think so far?

Main screen shows all HttpSessions ever created.

Request view shows all Http/JSF requests for the selected session.

Scoped Data view shows toString() value of each scoped attribute before and after each phase.

HttpServletRequest view shows incoming URL, headers, request params, cookies, etc.

Perf Data View shows which phases completed and how long each one took.

Tuesday, February 24, 2009

JSFUnit goes GA

I'm very happy to report that the JSFUnit 1.0.0.GA release is now out!

JSFUnit is the only end-to-end BlackBox/WhiteBox testing solution for JSF. Your tests run in-container and out-container at the same time. That is, JSFUnit lets your tests submit real HTTP requests using a headless browser. Then it lets you examine all the artifacts inside the container including the FacesContext, Managed Beans, UIComponent tree, FacesMessages, and much more. And since you are running inside the real container you never need a mock object or stub. You never have to worry about constructing a fake test environment.

Most of you reading this blog have heard all that stuff before, so I'll just talk a bit about the GA release. Here are the main changes from the Beta 3 release.
  • The conversion to HtmlUnit is now complete. The old client side API based on HttpUnit is completely gone. Since HtmlUnit is far better at handling javascript, this means that most JSF AJAX libraries will work right out of the box. The notable exception is ICEfaces, and I've been working with ICEfaces team to get support for that as soon as possible.
  • We now have a JSFUnit deployer for JBoss AS5. I blogged about this earlier. This deployer lets you run your JSFUnit tests without making a single change to your WAR. Click here for details.
  • JSF 2.0 support. I know you are wanting to play around with JSF 2.0, right? Now you don't have to give up test-first development while you explore.
  • The last change is a bit of sad news. The two developers who were working on the JSFUnit static analysis tool have moved on to new jobs where they are no longer using JSF. I versioned the code to 1.0 along with everything else, but I do want everyone to be aware that new features and bug fixes for static analysis won't happen until someone else steps up. If you are interested in taking this on let me know. JSF static analysis is really cool stuff and it's a very useful tool.
Lastly, I want to thank everyone who helped make JSFUnit happen. This is a new kind of tool that required a lot experimentation before we got it right. It has taken much longer to get here than I expected. The community feedback has been great and I've gotten tremendous support internally at JBoss/RedHat. So, in no particular order, thanks to Brian, Dennis, Jason, Matt, Shelly, Julien, Kragoth, Wolfgang, Patrick, Dimitris, Farah, Sacha, Kito, Pete, Ed, Ryan, Alexander, Jesper, Neil, Ken, and a bunch of others I've probably forgotten.

So long, and thanks for all the fish,


Monday, January 5, 2009

JSF 2.0 and the upcoming GA release of JSFUnit

I don't work on JSFUnit full time. A big part of my responsibility at JBoss/Red Hat is to make sure that JSF and Seam integrate nicely with the JBoss Application Server.

So I've been looking at the JSF 2.0 Public Review release. Using JSF 2.0 with JBoss AS 4.2 and AS 5.0 seems to be just a matter of replacing jsf-api.jar and jsf-impl.jar. I'm sure that I'll come across some things that need more/better integration. And when I do, I'll have to implement something new. But for now I'm happy to be able to play with the JSF 2.0 PR release as-is on JBoss AS.

To see how much would run without error, I decided to go ahead and upgrade JSFUnit to work with the new JSF 2.0 API. That required adding methods to JSFUnitFacesContext and JSFUnitExternalContext. There were some other code changes, including a change to the Environment class that detects which version of JSF is running.

Anyhow, I'm happy to report that JSFUnit now works with JSF 2.0. You can download the latest JSFUnit snapshot if you'd like to play with it. The part of the JSFUnit test suite that doesn't run is execution of the applications that use Facelets and Ajax4Jsf/RichFaces together. I've filed a bug on it, so hopefully that problem will be resolved soon. Please leave me feedback on the JSFUnit Forum if you decide to give it a try.

Lastly, I've been asked several times when JSFUnit is going to go GA. There is really nothing stopping me now except that I'd like to fix a few more bugs and maybe add support for IceFaces. Look for a release in mid-February.

So long and thanks for all the fish,