title: How to run the servlet test by using HttpUnit servlet runner? Problems in Starting up with ServletUnit?
body: <p>I was planning to unit test my Servlet through ServletUnit and ran across some problems :<br>
  - As a starting point, we are supposed to create a ServletRunner object. One of the constructors expects File object with web.xml file. I provide the full path of my web.xml file but somehow it ignores the path provided and searches at the top level folder. The code-snippet and error message is below:</p>
  
  <p><strong>Code Snippet</strong></p>
  
  <pre><code>    ServletRunner sr = new ServletRunner(new File("* C:/eclipse-workspaces/pocs/lms-csd/src/main/webapp/WEB-INF/web.xml*")); 
  ServletUnitClient sc = sr.newClient(); 
   WebRequest request = new PostMethodWebRequest("path to be specified" ); request.setParameter( "userId", "test" );
   request.setParameter( "password", "csd" );
    WebResponse response = sc.getResponse(request);
    String text = response.getText();
  </code></pre>
  
  <p>Assert.assertTrue(text.contains("Welcome to Leave Management System")); </p>
  
  <p><strong>stack trace</strong></p>
  
  <pre><code>    com.meterware.httpunit.HttpInternalErrorException:
   Error on HTTP request: 500 org.apache.jasper.JasperException: java.io.FileNotFoundException: * C:\eclipse-workspaces\pocs\lms-csd\WEB-INF\web.xml* 
  (The system cannot find the path specified)
  </code></pre>
  
  <p>[http://localhost/login]    - Why does the system keep on looking at the folder structure to be .../WEB-INF/web.xml.
   Mine is a maven project and I would not like to change the structure of the project to adapt this way. How can I make ServletRunner class to read from a specified folder ?   - In the Servlet code, 
  I use the following code : </p>
  
  <pre><code> String result = null if (someCondition) result = "/welcome.jsp"; } else { logger.warn("Password Validation failed"); request.setAttribute("failedlogin", new Boolean(true)); result = "/index.jsp"; } } RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher(result); requestDispatcher.forward(request, response); 
  </code></pre>
  
  <p>Again ServletUnit expects welcome.jsp to be at root foler, though jsp files are present at .../src/main/webapp/ folder. Again how can ServletUnit be told about the target folder location ?</p>
  
  <p>Many thanks in advance.  </p>
  
  <p>Best Regards
  M.SuriNaidu</p>