It occurred to me that if JSF is starting to see a lot of adoption, that there’s probably some testing framework for it, possibly to mock up things like FacesContext. Sadly it doesn’t appear as though there is much thought given to how to test JSF even though testing GUIs has been a pain point for a while now as seen in this post by Rob Williams:
The one thing that I bet is not even on the radar of the JSF team, but I would peg as its biggest shortcoming is its ill-disposition toward testing.
In the comments Rick Hightower mentions having mocked a FacesContext object to get around some things, though there’s no code to be seen. This was the best I could find after a lot of searching on how to unit test JSF. Something seems to be giving off a bad smell and I don’t think it’s my daughter’s dirty diaper.