Sachin, First make sure you are running the latest version of StrutsTestCase, http://sourceforge.net/project/showfiles.php?group_id=39190
1.1 is the latests, and get 2.3 if using a 2.3 container 2.2 if using a 2.2 container. Next, it looks like in your test case StrutsTestCase isn't finding WEB-INF. Either add it to your class path or do this in your test class: public void setUp() throws Exception { setContextDirectory(new File("/Path/to/WEB-INF/")); } There are other ways to do this, read the docs that come with StrutsTestCase. Good luck, John > -----Original Message----- > From: Sachin [mailto:[EMAIL PROTECTED] > Sent: Monday, August 04, 2003 1:03 AM > To: 'Struts Users Mailing List' > Cc: [EMAIL PROTECTED] > Subject: RE: Struts Test Case (new Bie..) > > Hi Andrew, > I have visited Site All sites but not been able to write > testCase > for Struts Actions. > examples they contains of Actions are using Perform method but now we are > using execute and Each time i am running testcase i got error. > > So can you suggest me what should i do.. > > I have gone on Cactus Forum but there is not enough discussion on forum > Hardly 20-30 people are there > and they most of time discussing Cactus plugin for Eclipse.. > > But i am not able to Write a simple testcase > > > So can Any body help me in this.. > > > public class TestSampleAction extends MockStrutsTestCase { > > public TestLoginAction(String testName) { super(testName); } > > public void testSuccessfulLogin() { > setRequestPathInfo("/login"); > addRequestParameter("username","deryl"); > addRequestParameter("password","radar"); > actionPerform(); > } > } > > > [main] INFO util.PropertyMessageResources - > Initializing,config='org.apache.struts.util.LocalStrings', returnNull=true > [main] INFO util.PropertyMessageResources - > Initializing,config='org.apache.struts.action.ActionResources', > returnNull=true > > 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.jav > a: > 339) > at > logic.struts.actions.TestFirstAction.testAction(TestFirstAction.java:47) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: > 39 > ) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm > pl > .java:25) > at > com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12 > ) > FAILURES!!! > > > > -----Original Message----- > From: Andrew Geery [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 31, 2003 5:59 PM > To: Struts Users Mailing List > Subject: Re: Struts Test Case (new Bie..) > > > It depends what type of tests you are writing. The cactus site has a > discussion about the mock object approach vs. the container approach > both on the main page ("Different kinds of unit tests" > http://jakarta.apache.org/cactus) and at > http://jakarta.apache.org/cactus/mock_vs_cactus.html > > For examples on how to use strutstestcase, look on the project's website: > http://strutstestcase.sourceforge.net/ > (The strutstestcase website also has a discussion of mock v. container > testing) > > I would recommend starting with mock objects (they're a little simpler > to use, simply because the application server isn't in the picture). > > Sachin wrote: > > >Hi All, > > > >can any body suggest me what is best test case approach to write > testcases > >for Actions and Forms > >Whether it should be MockStrutsTestCase Approach or > >CactusStrutsTestCase........ > >And where will i get examples on it.. > > > >Thanks > >Sachin > > > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] This communication is intended for the use of the individual(s) or entity it was addressed to and may contain confidential and/or privileged information. If the reader of this transmission is not the intended recipient, you are hereby notified that any review, dissemination, distribution or copying of this communication is prohibited. If you receive this communication in error, please notify the sender immediately and delete this communication from your system(s) to which it was sent and/or replicated to. (c) 2003 Sapiens Americas Corp. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]