Return-Path: list-help: list-unsubscribe: List-Post: List-Id: Mailing-List: contact cactus-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list cactus-user@jakarta.apache.org Received: (qmail 21115 invoked from network); 5 Aug 2003 07:50:37 -0000 Received: from smarthost1.mail.easynet.fr (212.180.1.68) by daedalus.apache.org with SMTP; 5 Aug 2003 07:50:37 -0000 Received: from [212.180.36.209] (helo=vma) by smarthost1.mail.easynet.fr with esmtp (Exim 3.35 #1 (Debian)) id 19jwaj-0003lA-00; Tue, 05 Aug 2003 09:50:46 +0200 From: "Vincent Massol" To: "'Cactus Users List'" Cc: Subject: RE: About TestCases Date: Tue, 5 Aug 2003 09:50:36 +0200 Message-ID: <026901c35b26$44559490$4024b4d4@vma> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <1ED3B4E590425444A316A6404D1FEDCB176B68@EXSERVER.pisoftek.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hi Sachin, Maybe you should post to the StrutsTestCase forum? This is the Cactus mailing list here and StrutsTestCase is a separate product. They have their own support on their SF forum. I cannot help you myself as I have never used StrutsTestCase. Thanks -Vincent > -----Original Message----- > From: Sachin [mailto:csachin@pisoftek.com] > Sent: 04 August 2003 14:28 > To: 'Stefan Groschupf' > Cc: Cactus User List (E-mail) > Subject: RE: About TestCases >=20 > Hi Stefan, > I have tested my code it is just a Action which is passing > control > to Another simple page. >=20 > My Actions is in logic.struts.actions > My Forms is in logic.struts.forms > My struts-config.xml is in WEB-INF directory >=20 > And Action is passing control to new page. >=20 > But when i am running it with mocktestcase or Cactus it is giving error. >=20 >=20 > I am working on IDEA and direct runnning TestCase... >=20 > Can you provide any help i am tired of searching on Net and ALL are > providing same example >=20 >=20 > public class LoginAction extends Action { > public ActionForward execute(ActionMapping mapping,ActionForm > form,HttpServletRequest request, >=20 > HttpServletResponse response) > { > String username =3D ((LoginForm) form).getFirstName(); > String password =3D ((LoginForm) form).getLastName(); >=20 > ActionErrors errors =3D new ActionErrors(); > return mapping.findForward("success"); > } > } >=20 > this is same as example in StrutsTestCase doc... & tried both with > CactusStrutsTestCase.. >=20 > public class TestLoginAction extends MockStrutsTestCase { >=20 > public TestLoginAction(String testName) { super(testName); } >=20 > public void testSuccessfulLogin() { > setRequestPathInfo("/login"); > addRequestParameter("username","deryl"); > addRequestParameter("password","radar"); > actionPerform(); > verifyForward("success"); > } > } >=20 >=20 > Error: > 0 [main] INFO util.PropertyMessageResources - Initializing, > config=3D'org.apache.struts.util.LocalStrings', returnNull=3Dtrue > 16 [main] INFO util.PropertyMessageResources - Initializing, > config=3D'org.apache.struts.action.ActionResources', returnNull=3Dtrue > .F > Time: 0.718 > There was 1 failure: > 1) > testSuccessfulLogin(logic.struts.actions.TestLoginAction)junit.framework .A > ss > ertionFailedError: Error running action.perform(): class > java.lang.NullPointerException - null > at > servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.j av > a: > 339) > at > logic.struts.actions.TestLoginAction.testSuccessfulLogin(TestLoginAction .j > av > a:32) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a: > 39 > ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Im > pl > .java:25) > at > com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java: 12 > ) >=20 > FAILURES!!! > Tests run: 1, Failures: 1, Errors: 0 >=20 > -----Original Message----- > From: Stefan Groschupf [mailto:sg@media-style.com] > Sent: Monday, August 04, 2003 4:56 PM > To: Cactus Users List; csachin@pisoftek.com > Subject: AW: About TestCases >=20 >=20 > Looks like your test failed since you have an nullpointer exception in > your > struts action. > So your test runs but your code not. >=20 > May be it make sense to use container tests for your struts class? >=20 > Greetings > Stefan >=20 > -----Urspr=FCngliche Nachricht----- > Von: Sachin [mailto:csachin@pisoftek.com] > Gesendet: 04 August 2003 12:19 > An: Kumar_maniranjan@infosys.com > Betreff: About TestCases >=20 > Hello Kumar.. >=20 > I am part of this forum for 3-4 days but i have as feeling that as compare > to other here activity is too slow and > I am not getting reponse for my question. >=20 > I have posted 3 Questions but got no reponse.well ia have just started > testCases with StrutsTestCase which has facility > to write TestCases with cactus but i am not able to test Struts Action > with > cactus or with mockObject based approach >=20 > Well then i have tried to run Example with testCase but not successful.. >=20 > So could you guide me where i can get proper feedback on testCases of > Struts > with Catus Approach.... >=20 >=20 > if Any body have Any suggestion then plz help me >=20 >=20 >=20 > So can Any body help me in this.. >=20 >=20 > public class TestSampleAction extends MockStrutsTestCase { >=20 > public TestLoginAction(String testName) { super(testName); } >=20 > public void testSuccessfulLogin() { > setRequestPathInfo("/login"); > addRequestParameter("username","deryl"); > addRequestParameter("password","radar"); > actionPerform(); > } > } >=20 >=20 > [main] INFO util.PropertyMessageResources - > Initializing,config=3D'org.apache.struts.util.LocalStrings', returnNull=3Dtrue > [main] INFO util.PropertyMessageResources - > Initializing,config=3D'org.apache.struts.action.ActionResources', > returnNull=3Dtrue >=20 > Time: 0.625 > There was 1 failure: > 1)testAction(logic.struts.actions.TestFirstAction) > junit.framework.AssertionFailedError: Error running action.perform(): > classjava.lang.NullPointerException - null > at > servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.j av > a: > 339) > at > logic.struts.actions.TestFirstAction.testAction(TestFirstAction.java:47) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a: > 39 > ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Im > pl > .java:25) > at > com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java: 12 > ) > FAILURES!!! >=20 >=20 >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: cactus-user-help@jakarta.apache.org >=20 >=20 >=20 >=20 >=20 >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: cactus-user-help@jakarta.apache.org