Re: [Httpunit-develop] Problems in Starting up with ServletUnit
Brought to you by:
russgold
From: Laxman K. <lax...@ho...> - 2011-01-16 12:24:43
|
Hi Narindar Kumar, This is Kishan from hyd,india. I would like to know about httpunit. Could you please tell me will it work for testing any type of web sites (ie. banking / finance / commerial / entertainment / gov. / public services and moreover with https protocol ) also ? Because I tried to connect to my gmail account & my internet banking for my account., its not loading home package even since Some scriptlet engine error coming while loading home pages itself. But through htmlunit I'm unable to access any of web site with having any issue. Can you please tel me what could be the issue I just downloaded httpunit jar & other dependencies jars also from sourceforge.net link only. But its unable to access all web sites whatever we want to connect & access for testing. Please help me out what to do to access all require web sites by using this httpunit ..! I'm eagerly waiting for your reply soon. Thank you & regards, Kishan. Hyd,India. Date: Thu, 13 Jan 2011 19:18:37 +0530 From: nk...@in... To: htt...@li... Subject: Re: [Httpunit-develop] Problems in Starting up with ServletUnit Hi Wolfgang, Thanks for your reply. I will try to dig into it myself and get back to you with more information if I am able to find the root cause of the problem. BTW : Are you the only one supporting httpunit and servlet modules or you get some other collaborators as well from time to time ? Best RegardsNarinder 2011/1/13 Wolfgang Fahl <wf...@bi...> Narinder, thanks for making the mailinglist a bit more active with your e-mail. I'd be happy to support you but there are two obstacles: - Servlet...something is not the part of httpunit I know well - I have other urgent issues on my agenda that hold me up. You might want to investigate a solution and post it accoring to the FAQs. Yours Wolfgang Am 13.01.11 11:19, schrieb Narinder Kumar: Hi, I was planning to unit test my Servlet through ServletUnit and ran across some problems : 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: <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("http://localhost/login" ); request.setParameter( "userId", "test" ); request.setParameter( "password", "csd" ); WebResponse response = sc.getResponse(request); String text = response.getText(); Assert.assertTrue(text.contains("Welcome to Leave Management System")); </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) [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 : 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); 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 ? Many thanks in advance. Best Regards Narinder ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Httpunit-develop mailing list Htt...@li... https://lists.sourceforge.net/lists/listinfo/httpunit-develop -- BITPlan - smart solutions Wolfgang Fahl Pater-Delp-Str. 1, D-47877 Willich Schiefbahn Tel. +49 2154 811-480, Fax +49 2154 811-481 Web: http://www.bitplan.de BITPlan GmbH, Willich - HRB 6820 Krefeld, Steuer-Nr.: 10258040548, Geschäftsführer: Wolfgang Fahl ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Httpunit-develop mailing list Htt...@li... https://lists.sourceforge.net/lists/listinfo/httpunit-develop ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Httpunit-develop mailing list Htt...@li... https://lists.sourceforge.net/lists/listinfo/httpunit-develop |