You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by HelpMePlz <su...@gmail.com> on 2008/05/14 06:51:31 UTC
java.lang.NoClassDefFoundError: junit/framework/Test
Hi to All
i am new to this forum . i am getting this error
java.lang.NoClassDefFoundError: junit/framework/Test
for one of my testcase class.my testcase class is
import servletunit.struts.MockStrutsTestCase;
public class TestAdminLogin extends MockStrutsTestCase{
public TestAdminLogin(String testName) {
super(testName);
}
public void setUp() throws Exception {
super.setUp();
setInitParameter("validating","false");
}
public void testSuccessfulLogin() {
addRequestParameter("username","sai");
addRequestParameter("password","sai");
setRequestPathInfo("/login");
actionPerform();
verifyForward("success");
verifyForwardPath("/pages/bookDetails.jsp");
assertEquals("sai",getSession().getAttribute("authentication"));
verifyNoActionErrors();
}
/* public void testFailedLogin() {
addRequestParameter("username","sai");
addRequestParameter("password","suri");
setRequestPathInfo("/adminlogin");
actionPerform();
verifyForward("adminlogin");
verifyForwardPath("/pages/AdminLoginPage.jsp");
verifyInputForward();
verifyActionErrors(new String[] {"error.password.mismatch"});
assertNull(getSession().getAttribute("authentication"));
}*/
public static void main(String[] args) {
junit.textui.TestRunner.run(TestAdminLogin.class);
}
}
struts-config.xml:--
--------------------
<global-forwards>
<!-- Default forward to "Welcome" action -->
<!-- Demonstrates using index.jsp to forward -->
<forward
name="welcome"
path="/Welcome.do"/>
<forward name="login" path="/login.do"></forward>
<forward name="adminlogin" path="/adminlogin.do"></forward>
<forward name="userbooks" path="userbooks.do" />
<forward name="userlogin" path="userlogin.do" />
</global-forwards>
<!-- =========================================== Action Mapping Definitions
-->
<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/Welcome"
forward="/pages/Welcome.jsp"/>
<action path="/login" forward="/pages/adminlogin.jsp"></action>
<action path="/adminlogin"
type="Library.Actions.AdminLogin"
name="AdminFormBean"
scope="request"
validate="false"
input="/pages/adminlogin.jsp" >
<forward name="success"
path="/pages/bookDetails.jsp"></forward>
</action>
<action path="/adminbooks"
name="AdminFormBean"
scope="session"
validate="false"
type="Library.Actions.AdminActions"
input="/pages/bookDetails.jsp">
<forward name="new" path="/new.do"></forward>
<forward name="save"
path="/save.do"></forward>
<forward name="update"
path="/update.do"></forward>
<forward name="edit" path="/edit.do"></forward>
<forward name="issuedbook"
path="/issuedbook.do"></forward>
<forward name="issued"
path="/issued.do"></forward>
<forward name="returned"
path="/returned.do"></forward>
<forward name="returnedbook"
path="/returnedbook.do"></forward>
</action>
when i am running the testcase class . i have
java.lang.NoClassDefFoundError: junit/framework/Test
if any one know solution about this problem . plz reply me . it is urgent
for me
--
View this message in context: http://www.nabble.com/java.lang.NoClassDefFoundError%3A-junit-framework-Test-tp17223314p17223314.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
AW: java.lang.NoClassDefFoundError: junit/framework/Test
Posted by Ja...@rzf.fin-nrw.de.
You need JUnit's jar file (junit-<version>.jar) on your classpath.
Jan
> -----Ursprüngliche Nachricht-----
> Von: HelpMePlz [mailto:supriyanaidupelluru@gmail.com]
> Gesendet: Mittwoch, 14. Mai 2008 06:52
> An: user@ant.apache.org
> Betreff: java.lang.NoClassDefFoundError: junit/framework/Test
>
>
> Hi to All
>
>
> i am new to this forum . i am getting this error
>
>
> java.lang.NoClassDefFoundError: junit/framework/Test
>
>
> for one of my testcase class.my testcase class is
>
>
> import servletunit.struts.MockStrutsTestCase;
>
>
> public class TestAdminLogin extends MockStrutsTestCase{
>
> public TestAdminLogin(String testName) {
> super(testName);
> }
>
>
> public void setUp() throws Exception {
> super.setUp();
> setInitParameter("validating","false");
> }
>
>
> public void testSuccessfulLogin() {
>
> addRequestParameter("username","sai");
> addRequestParameter("password","sai");
> setRequestPathInfo("/login");
> actionPerform();
> verifyForward("success");
> verifyForwardPath("/pages/bookDetails.jsp");
>
> assertEquals("sai",getSession().getAttribute("authentication"));
> verifyNoActionErrors();
> }
>
>
> /* public void testFailedLogin() {
>
> addRequestParameter("username","sai");
> addRequestParameter("password","suri");
> setRequestPathInfo("/adminlogin");
> actionPerform();
> verifyForward("adminlogin");
> verifyForwardPath("/pages/AdminLoginPage.jsp");
> verifyInputForward();
> verifyActionErrors(new String[]
> {"error.password.mismatch"});
> assertNull(getSession().getAttribute("authentication"));
> }*/
>
> public static void main(String[] args) {
> junit.textui.TestRunner.run(TestAdminLogin.class);
> }
>
> }
>
> struts-config.xml:--
> --------------------
>
>
>
> <global-forwards>
> <!-- Default forward to "Welcome" action -->
> <!-- Demonstrates using index.jsp to forward -->
> <forward
> name="welcome"
> path="/Welcome.do"/>
>
> <forward name="login" path="/login.do"></forward>
>
> <forward name="adminlogin"
> path="/adminlogin.do"></forward>
>
> <forward name="userbooks" path="userbooks.do" />
>
>
> <forward name="userlogin" path="userlogin.do" />
> </global-forwards>
>
>
> <!-- =========================================== Action
> Mapping Definitions
> -->
>
> <action-mappings>
> <!-- Default "Welcome" action -->
> <!-- Forwards to Welcome.jsp -->
> <action
> path="/Welcome"
> forward="/pages/Welcome.jsp"/>
>
> <action path="/login"
> forward="/pages/adminlogin.jsp"></action>
>
> <action path="/adminlogin"
>
> type="Library.Actions.AdminLogin"
>
> name="AdminFormBean"
>
> scope="request"
>
> validate="false"
>
> input="/pages/adminlogin.jsp" >
>
> <forward name="success"
> path="/pages/bookDetails.jsp"></forward>
>
> </action>
>
>
>
>
>
> <action path="/adminbooks"
>
>
> name="AdminFormBean"
>
> scope="session"
>
> validate="false"
>
> type="Library.Actions.AdminActions"
>
> input="/pages/bookDetails.jsp">
> <forward name="new"
> path="/new.do"></forward>
>
> <forward name="save"
> path="/save.do"></forward>
>
> <forward name="update"
> path="/update.do"></forward>
>
> <forward name="edit"
> path="/edit.do"></forward>
>
> <forward name="issuedbook"
> path="/issuedbook.do"></forward>
>
> <forward name="issued"
> path="/issued.do"></forward>
>
> <forward name="returned"
> path="/returned.do"></forward>
>
> <forward name="returnedbook"
> path="/returnedbook.do"></forward>
> </action>
>
>
>
> when i am running the testcase class . i have
>
> java.lang.NoClassDefFoundError: junit/framework/Test
>
> if any one know solution about this problem . plz reply me .
> it is urgent
> for me
>
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/java.lang.NoClassDefFoundError%3A-junit-
> framework-Test-tp17223314p17223314.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org