Loading
Cactus Unit Testcase

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  Cactus Unit Testcase Sample ?


Ans)

Cactus is used for Unit Testing of the source code which requires a Servlet Containers
meaning which requies HTTPServletRequest, HTTPServletResponse.

Step 1:

import org.apache.cactus.ServletTestCase;
import org.junit.Test;

public class YourCactusTest extends ServletTestCase {

 protected void setUp() throws Exception {
  Cache.reLoadCache();
 }
  
 @Test
 public void testFillPriceLines ()  {
  assertEquals(2, hboCount);
  assertEquals(3, premierCount);
 }
 
 @Test
 public void testFillPriceLinesOnlyHBO ()  {
  assertEquals(2, hboCount);
 }
}


Step 2:

Deploy your test in a Servlet Container and use the following URL to
run the Test.

http://host:port/yourApp/ServletRedirector?Cactus_Service=RUN_TEST
Or
http://host:port/yourApp/ServletTestRunner?suite=YourCactusTest

Step 3 :

Add the Following to web.xml

  <servlet>
    <servlet-name>ServletRedirector</servlet-name>
    <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
  </servlet>

  <servlet>
    <servlet-name>ServletTestRunner</servlet-name>
    <servlet-class>org.apache.cactus.server.runner.ServletTestRunner</servlet-class>
  </servlet>



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

Cactus Unit Testcase


Cactus Unit Testcase

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free