Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

StrutsTestCase problem

 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the error I get when I run my testcase. There are many who have got this error when I googeled but found no solution.

Unable to initialize Struts ActionServlet due to an unexpected exception or error thrown, so marking the servlet as unavailable. Most likely, this is due to an incorrect or missing library dependency.

public class TestLoginAction extends MockStrutsTestCase{
public void setUp() throws Exception { super.setUp();
}
public void tearDown() throws Exception { super.tearDown(); }
public TestLoginAction(String testName) { super(testName); }


public void testSuccessfulLogin() {
setRequestPathInfo("/login");
addRequestParameter("username","aaa");
addRequestParameter("password","aaa");
actionPerform(); //error here
verifyForward("success");
assertEquals("aaa",(String) getSession().getAttribute("authentication"));
verifyNoActionErrors();
}


I have

JDK1.5 --RAD6---Struts 1.2.9

all are in Java Build Path (RAD projects--properties-javabuildpath)

junit-4.5.jar
strutstest-2.1.4.jar
Struts 1.2.9
jdk 1.5
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you wanted to post this in the Struts forum and not the forum underneath the Struts forum.

So I will move this one for you to the appropriate forum.

Have fun

Mark
 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Web-inf has to be in classpath of Junit
Run ... -> Classpath -> User Entries -> Advanced -> Add Folders, then pick the folder webcontent (it has to point to directory above web-inf, not web-inf )
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic