This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Testing and the fly likes Testing Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Testing Servlets" Watch "Testing Servlets" New topic
Author

Testing Servlets

Manohar Karamballi
Ranch Hand

Joined: Jul 17, 2001
Posts: 227
I have newbie these testing Unit world..
I am facing following problem in using servlet unit.
my testcase code..

public class ODDSControllerSTest extends TestCase
{
public static void main(String args[])
{
junit.textui.TestRunner.run( suite() );
}
public static Test suite()
{
return new TestSuite( ODDSControllerSTest.class );
}

public ODDSControllerSTest( String name )
{
super( name );
}
public void testHeader() throws Exception
{
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest( "http://localhost:8080/LNT/ODDSControllerS" );
WebResponse response = conversation.getResponse( request );
assertEquals("Response failed",200,response.getResponseCode());
}

}*/

//import junit related classes
import com.meterware.servletunit.*;
import com.meterware.httpunit.*;
import junit.framework.*;
//import javax related classes
import javax.servlet.ServletOutputStream;
//import java related classes
import java.io.*;
public class LNTControllerSTest extends TestCase
{
public void testForwardToRetrieveJSP() throws Exception
{
ServletRunner sr = new ServletRunner( "web.xml" );
ServletUnitClient client = sr.newClient();
}
}
@ line2 that is getting client ,am getting error
java.lang.ExceptionininitializeError
pls help me out

TIA
Manohar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Testing Servlets