You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by "Shenoy, Anjali" <an...@bankofamerica.com> on 2005/08/25 23:42:33 UTC

Testing servlets with cactus

Has anyone successfully tested servlets with cactus???

I have the following requirements:

JBuilder - Not really a requirement but convinient.
JRun 3.0

my code looks as follows:

package com.boa.gcib.docwf.newsdm.servlets;

import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
import org.apache.cactus.WebResponse;
import junit.framework.*;

import java.io.*;


public class TestLogin extends ServletTestCase{
private TestLogin loginTest = null;
private static final String USER_ID_KEY = "strUserID";
private static final String PASSWORD_KEY = "strPassword";
private static final String ACTIVE = "Y";

public void beginDummyTest(WebRequest theRequest){
theRequest.setURL("http://localhost", "/servlet", "/com.boa.gcib.docwf.newsdm.servlets.login", "/", null);
System.out.println(theRequest.getURL().getContextPath());
// theRequest.get
// login.getServletContext().getContext("http://localhost/servlets/com.boa.gcib.docwf.newsdm.servlets.login");
}

// protected void tearDown() throws Exception {
// loginTest = null;
// super.tearDown();
// }

public void testDummyTest(){
assertEquals(loginTest.USER_ID_KEY, "abcde");
}


}

It doesn't matter what I type in or try in the code, when I run the test, it always gives me a ChainedRuntimeException: Missing cactus property[cactus.contextURL].

But I've already set the URL in the "begin" method!!

Does anyone have any ideas??? Thanks!


Re: Testing servlets with cactus

Posted by Romain Thouvenin <rt...@sfwan.com>.
You should read the online documentation.
You must have a file cactus.properties in your classpath wich set at 
least the cactus.contextURL property.

Romain

Shenoy, Anjali a écrit :

>Has anyone successfully tested servlets with cactus???
>
>[...]
>It doesn't matter what I type in or try in the code, when I run the test, it always gives me a ChainedRuntimeException: Missing cactus property[cactus.contextURL].
>
>But I've already set the URL in the "begin" method!!
>
>Does anyone have any ideas??? Thanks!
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>
>
>
>  
>