jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kazuhito SUGURI <suguri.kazuh...@lab.ntt.co.jp>
Subject Re: Assesrtion Failed Error while JSP Testing
Date Tue, 10 Feb 2004 10:11:17 GMT
Hi Dinesh,

In article <20040209070559.630CF2B2B09@ws5-7.us4.outblaze.com>,
Mon, 09 Feb 2004 15:05:59 +0800,
"Dinesh N" <gnavsupe@india.com> wrote: 
gnavsupe> I am new to this technology. I am testing a jsp page which do some operation
on java compiled class.
gnavsupe> Now i have created some test case like:
gnavsupe> public void teststringArray3()
gnavsupe> 	{
gnavsupe> 		 System.out.println("Value is "+session.getServletContext().getAttribute("stringArray3Count"));
gnavsupe> 		 assertSame("This should be same","1",session.getServletContext().getAttribute("stringArray3Count"));
gnavsupe> 	}

It should have pageContext.include("/test.jsp"), as you had tried.
Also, you should use assertEquals, as Rainsberger noticed.

gnavsupe> I also tried with. pageContext.include("/test.jsp");
gnavsupe> and then pageContext.getAttribute(stringArray3Count());
gnavsupe> But still it returns null.

I believe that the stringArray3Count() should be "stringArray3Count".

In article <20040210070939.9091A3AA42D@ws5-8.us4.outblaze.com>,
Tue, 10 Feb 2004 15:09:37 +0800,
"Dinesh N" <gnavsupe@india.com> wrote: 
gnavsupe>           I will give you  my JSP which i want to test.
gnavsupe> It is:
gnavsupe>   <%@page import="com.arraytest.StringArray"%>

I wrote (and tested) a sample JSP with JspTestCase.
It uses java.lang.String for attributes, however,
I believe that you can find out what you have to do
for your com.arraytest.StringArray.

I hope this will helps you.
Kazuhito SUGURI

View raw message