You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Sreedevi Aswath <sr...@gmail.com> on 2006/07/10 08:37:04 UTC
Unit Test Cases for jsf application using shale
Hi,
I am using myfaces and tomahawk for my application.
I have a page with <t:datatable> and a commandbutton.
<t:dataTable id="ptable" value="#{myManager.profiles}" var="profile"
binding="#{myBean.uiTable}" >
There is a selectBooleanCheckbox against each row. When a row is
selected and clicked on the edit button
in the corresponding edit action method, the info is retrieved this way.
InfoBean bean = (InfoBean) FacesContext.getCurrentInstance
().getExternalContext().getSessionMap().put
("item",FacesContext.getCurrentInstance
().getExternalContext().getRequestMap().get("profile"));
I need to write a unit test case for the edit action method using shale.
I am using the shale-test.jar that mocks up
the JSF environment. I am creating a uitable component and setting up
the value, var and binding. I am also creating a datamodel
instance and populating it with arraylist of data.But I am getting a
NullPointerException. How do I exactly mock the way, the row is
selected and when clicked on the edit button should give me the value of
the uitable in the request context, just as above?
I would very much appreciate a response.
Thanks,
-Sreedevi
Re: Unit Test Cases for jsf application using shale
Posted by Matthias Wessendorf <ma...@apache.org>.
Shale also now (in nbuild) supports JMock,
I think I will convert the Tree2 test to a jmock tc
or provide an *different* one, optionally
-Matt
On 7/10/06, Sean Schofield <se...@gmail.com> wrote:
> You could try looking at the unit tests for tree2. I recently wrote
> some using shale-test. At least this might be a good starting point
> even if it doesn't exactly address your question.
>
> Sean
>
> On 7/10/06, Sreedevi Aswath <sr...@gmail.com> wrote:
> > Hi,
> >
> > I am using myfaces and tomahawk for my application.
> > I have a page with <t:datatable> and a commandbutton.
> >
> > <t:dataTable id="ptable" value="#{myManager.profiles}" var="profile"
> > binding="#{myBean.uiTable}" >
> >
> > There is a selectBooleanCheckbox against each row. When a row is
> > selected and clicked on the edit button
> > in the corresponding edit action method, the info is retrieved this way.
> >
> > InfoBean bean = (InfoBean) FacesContext.getCurrentInstance
> > ().getExternalContext().getSessionMap().put
> > ("item",FacesContext.getCurrentInstance
> > ().getExternalContext().getRequestMap().get("profile"));
> >
> > I need to write a unit test case for the edit action method using shale.
> > I am using the shale-test.jar that mocks up
> > the JSF environment. I am creating a uitable component and setting up
> > the value, var and binding. I am also creating a datamodel
> > instance and populating it with arraylist of data.But I am getting a
> > NullPointerException. How do I exactly mock the way, the row is
> > selected and when clicked on the edit button should give me the value of
> > the uitable in the request context, just as above?
> >
> > I would very much appreciate a response.
> >
> > Thanks,
> > -Sreedevi
> >
> >
>
--
Matthias Wessendorf
futher stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com
Re: Unit Test Cases for jsf application using shale
Posted by Sean Schofield <se...@gmail.com>.
You could try looking at the unit tests for tree2. I recently wrote
some using shale-test. At least this might be a good starting point
even if it doesn't exactly address your question.
Sean
On 7/10/06, Sreedevi Aswath <sr...@gmail.com> wrote:
> Hi,
>
> I am using myfaces and tomahawk for my application.
> I have a page with <t:datatable> and a commandbutton.
>
> <t:dataTable id="ptable" value="#{myManager.profiles}" var="profile"
> binding="#{myBean.uiTable}" >
>
> There is a selectBooleanCheckbox against each row. When a row is
> selected and clicked on the edit button
> in the corresponding edit action method, the info is retrieved this way.
>
> InfoBean bean = (InfoBean) FacesContext.getCurrentInstance
> ().getExternalContext().getSessionMap().put
> ("item",FacesContext.getCurrentInstance
> ().getExternalContext().getRequestMap().get("profile"));
>
> I need to write a unit test case for the edit action method using shale.
> I am using the shale-test.jar that mocks up
> the JSF environment. I am creating a uitable component and setting up
> the value, var and binding. I am also creating a datamodel
> instance and populating it with arraylist of data.But I am getting a
> NullPointerException. How do I exactly mock the way, the row is
> selected and when clicked on the edit button should give me the value of
> the uitable in the request context, just as above?
>
> I would very much appreciate a response.
>
> Thanks,
> -Sreedevi
>
>