jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@pivolis.com>
Subject RE: Assesrtion Failed Error while JSP Testing
Date Tue, 10 Feb 2004 14:04:12 GMT
Hi Dinesh,

You need to call this JSP somewhere in your test! :-)

-Vincent

> -----Original Message-----
> From: Dinesh N [mailto:gnavsupe@india.com]
> Sent: 10 February 2004 08:10
> To: Cactus Users List
> Subject: RE: Assesrtion Failed Error while JSP Testing
> 
> 
> Hi Vincent,
>           I will give you  my JSP which i want to test.
> 
> It is:
> 
>   <%@page import="com.arraytest.StringArray"%>
> 
> <%
>   StringArray stringArray1 = new StringArray();
>   stringArray1.add("itemForStringArray1");
>   pageContext.setAttribute("stringArray1",
>   stringArray1);
> StringArray stringArray2 = new StringArray();
> stringArray2.add("itemForStringArray2");
> stringArray2.delete(0);
> pageContext.setAttribute("stringArray2", stringArray2,
> PageContext.SESSION_SCOPE);
> StringArray stringArray3 = new StringArray();
> stringArray3.add("itemForStringArray3");
> pageContext.setAttribute("stringArray3Count",
> String.valueOf(stringArray3.count()), PageContext.APPLICATION_SCOPE);
> %>
> 
> This is JSP wich is doing some StringList Inser add delete operation.
And
> this "itemForStringArray3Count" and infact all others also i want to
> access in TestClass which i mentioned in previous mail.
> 
> In this TestStringArray3() -- I want to test the correct value is
returned
> and asdet in JSP.
> Thats all. Its just preliminary level.
> 
> If you could help me i will be very happy.
> 
> ----- Original Message -----
> From: "Vincent Massol" <vmassol@pivolis.com>
> Date: Mon, 9 Feb 2004 21:09:19 +0100
> To: "'Cactus Users List'" <cactus-user@jakarta.apache.org>
> Subject: RE: Assesrtion Failed Error while JSP Testing
> 
> > Hi Dinesh,
> >
> > Can you please show us your test case? The teststringArray3() method
> > does not call anything that sets your stringArrya3Count attribute in
the
> > servlet context. Where is that set?
> >
> > Thanks
> > -Vincent
> >
> > > -----Original Message-----
> > > From: Dinesh N [mailto:gnavsupe@india.com]
> > > Sent: 09 February 2004 08:06
> > > To: cactus-user@jakarta.apache.org
> > > Subject: Assesrtion Failed Error while JSP Testing
> > >
> > > Hi Friends,
> > >     I am new to this technology. I am testing a jsp page which do
some
> > > operation on java compiled class.
> > >
> > > Now i have created some test case like:
> > >
> > > public void teststringArray3()
> > > 	{
> > > 		 System.out.println("Value is
> > > "+session.getServletContext().getAttribute("stringArray3Count"));
> > > 		 assertSame("This should be
> > >
> >
same","1",session.getServletContext().getAttribute("stringArray3Count"))
> > ;
> > >
> > > 	}
> > >
> > > ****stringArray3Count is an veriable which is set to proper value
in
> > JSP
> > > Page.
> > >
> > > But i am not able to access the Value in Test class. It is
returning
> > NULL.
> > > CAn anybody help me...?
> > > Please let me know where is problem in my Code or what..?
> > >
> > > I also tried with. pageContext.include("/test.jsp");
> > > and then pageContext.getAttribute(stringArray3Count());
> > > But still it returns null.
> > >
> > > After running the Result is:
> > >
> > >    This should be same expected same:<1> was not:<null>
> > >
> > > junit.framework.AssertionFailedError: This should be same expected
> > > same:<1> was not:<null>
> > > at:
> > > arraytest.StringArrayJSPTest.teststringArray3
> > >
> > > CAn anybody tell me what is the problem ?
> > >
> > > Thanking You,
> > >
> > > Ragards,
> > > Dinesh N.
> > >
> > > --
> > > India.com free e-mail - www.india.com.
> > > Check out our value-added Premium features, such as an extra 20MB
for
> > mail
> > > storage, POP3, e-mail forwarding, and ads-free mailboxes!
> > >
> > > Powered by Outblaze
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail:
cactus-user-help@jakarta.apache.org
> >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> >
> 
> 
> 
> Thanking You,
> 
> Ragards,
> Dinesh N.
> 
> --
> India.com free e-mail - www.india.com.
> Check out our value-added Premium features, such as an extra 20MB for
mail
> storage, POP3, e-mail forwarding, and ads-free mailboxes!
> 
> Powered by Outblaze
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



Mime
View raw message