myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: Using Shale Test Framework with MyFaces
Date Tue, 14 Feb 2006 23:58:01 GMT
On 2/14/06, CONNER, BRENDAN (SBCSI) <> wrote:
> Thanks.  Is it an appropriate framework to use for application-level
> tests?
> For example, to test a managed bean's action method that does something
> like the following:
> 1. Gets values from two or three managed beans

No problem ... the framework mocks the managed bean system and (at least
limited) evaluation of value binding and method binding expressions.

2. Looks up the "selected record" from a DataModel object within one of
> the beans

Presuming that you've got your DataModel configured with an appropriate
database connection, this should work.

3. Performs a JNDI lookup of a Session Bean

JNDI lookups are not currently supported.  It would be pretty
straightforward to mock up a JNDI InitialContext for something like a
DataSource; but the framework doesn't pretend to implement anything
EJB-ish.   If we go ahead and and created a MockInitialContext, you might
consider setting up mocks for your Session Beans -- we could convincingly
fake the JNDI lookup part, but not the EJB behavior part.  I wouldn't even
want to *think* about emulating all that, unless we were talking EJB3 with
out-of-the-container execution abilities.

4. Invokes the Session Bean to insert something into the database

Limited by the previous issue.

5. Queues a message to FacesContext

That part will work.

6. Returns an outcome string

So will that ... you can have a JUnit test method do assertions on the
outcome returned when you call the action method.

- Brendan


View raw message