Java Doc for HtmlUnitTestCase.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » apache lenya 2.0 » org.apache.cocoon 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.cocoon.HtmlUnitTestCase

All known Subclasses:   org.apache.cocoon.WebdavStep3TestCase,  org.apache.cocoon.CachingPipelineTestCase,  org.apache.cocoon.CalcTestCase,  org.apache.cocoon.ReaderMimeTypeTestCase,  org.apache.cocoon.Bug36872HttpHeaderActionTestCase,  org.apache.cocoon.FlowscriptReloadTestCase,  org.apache.cocoon.Bug26186InternalRequestMemoryLeakTestCase,  org.apache.cocoon.Bug26571SendPageRedirectTestCase,  org.apache.cocoon.FlowscriptDOMDumpTestCase,  org.apache.cocoon.HtmlSerializerTestCase,  org.apache.cocoon.FlowscriptRecursiveTestCase,  org.apache.cocoon.BatikSampleMimeTypesTestCase,  org.apache.cocoon.RedirectTestCase,  org.apache.cocoon.InternalSendPageTestCase,  org.apache.cocoon.XslTalTestCase,  org.apache.cocoon.WebdavDavmapTestCase,  org.apache.cocoon.SitemapAnnotationsTestCase,  org.apache.cocoon.InternalRequestTestCase,  org.apache.cocoon.SitemapReloadTestCase,  org.apache.cocoon.FormsSharingViewDataTestCase,
HtmlUnitTestCase
abstract public class HtmlUnitTestCase extends TestCase (Code)
Base class to run test cases on Cocoon samples.

This class extends the JUnit TestCase class to setup an environment which makes it possible to easily test Cocoon pages. First call one of the load methods and then assert on the response object, XML document (@see loadXmlPage), or HTML document (@see loadHtmlPage).

Examples:

 public void testStatus() {
 loadResponse("/samples/test/status");
 assertEquals("Status code", 200, response.getStatusCode());
 }
 public void testTitle() {
 loadHtmlPage("/samples/test/title");
 assertXPath("html/head/title"", "The Title");
 }
 

For loading XML and HTML documents currently on GET requests with optional querystring are supported. Please add POST requests and request parameters when you need them.


version:
   $Id: $


Field Summary
protected  URLbaseURL
     Base URL of the running Cocoon server which is to be tested.
protected  Objectdocument
     Low-level access to XML document (org.w3c.dom.Document) or HTML document (com.gargoylesoftware.htmlunit.html.HtmlPage).
protected  Loggerlogger
     Logger for informative output by test cases.
protected  Mapnamespaces
     Low-level access to namespace mappings for XPath expressions.
protected  WebResponseresponse
     Low-level access to WebResponse object.
protected  WebClientwebClient
     Low-level access to WebClient object.


Method Summary
protected  voidaddNamespace(String prefix, String uri)
     Add a namespace mapping for XPath expressions.
protected  voidassertXPath(String xpathExpr, String expected)
     Assert that XPath expression result matches exactly expected value.
protected  voidcopyWebappFile(String filename, String param, String value)
     Copy file from webapp source to deployment area filtering content to replace parameter by value.
protected  StringevalXPath(String xpathExpr)
     Returns XPath expression as string.
protected  voidloadDeleteResponse(String pageURL)
     Sends HTTP DELETE request and loads response object.
protected  voidloadHtmlPage(String pageURL)
     Sends HTTP request and parses response as HTML document.
protected  voidloadPutResponse(String pageURL, String content)
     Sends HTTP PUT request and loads response object.
protected  voidloadResponse(String pageURL)
     Sends HTTP GET request and loads response object.
protected  voidloadXmlPage(String pageURL)
     Sends HTTP request and parses response as XML document.
protected  voidsetUp()
    
protected  voidtearDown()
    

Field Detail
baseURL
protected URL baseURL(Code)
Base URL of the running Cocoon server which is to be tested. Set by property htmlunit.test.baseurl usually as http://localhost:8888/.



document
protected Object document(Code)
Low-level access to XML document (org.w3c.dom.Document) or HTML document (com.gargoylesoftware.htmlunit.html.HtmlPage).



logger
protected Logger logger(Code)
Logger for informative output by test cases. The default log level is WARN but may be changed by setting the property junit.test.loglevel to a different numeric value.



namespaces
protected Map namespaces(Code)
Low-level access to namespace mappings for XPath expressions.



response
protected WebResponse response(Code)
Low-level access to WebResponse object.



webClient
protected WebClient webClient(Code)
Low-level access to WebClient object.





Method Detail
addNamespace
protected void addNamespace(String prefix, String uri) throws Exception(Code)
Add a namespace mapping for XPath expressions.



assertXPath
protected void assertXPath(String xpathExpr, String expected) throws Exception(Code)
Assert that XPath expression result matches exactly expected value.



copyWebappFile
protected void copyWebappFile(String filename, String param, String value) throws Exception(Code)
Copy file from webapp source to deployment area filtering content to replace parameter by value. The source and deployment directories are defined by the properties htmlunit.test.source-dir and htmlunit.test.deploy-dir. This method is most useful for testing the automatic reloading of changed files.



evalXPath
protected String evalXPath(String xpathExpr) throws Exception(Code)
Returns XPath expression as string.
Parameters:
  xpathExpr - XPath expression Value of XPath expression in current document.Empty string if XPath not matched.



loadDeleteResponse
protected void loadDeleteResponse(String pageURL) throws Exception(Code)
Sends HTTP DELETE request and loads response object.



loadHtmlPage
protected void loadHtmlPage(String pageURL) throws Exception(Code)
Sends HTTP request and parses response as HTML document.



loadPutResponse
protected void loadPutResponse(String pageURL, String content) throws Exception(Code)
Sends HTTP PUT request and loads response object.



loadResponse
protected void loadResponse(String pageURL) throws Exception(Code)
Sends HTTP GET request and loads response object.



loadXmlPage
protected void loadXmlPage(String pageURL) throws Exception(Code)
Sends HTTP request and parses response as XML document.



setUp
protected void setUp() throws Exception(Code)



tearDown
protected void tearDown() throws Exception(Code)



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.