HttpUnit is an open source test framework for web applications which can provide browser specific behaviour like sending request to the We are using Spring sts , JDK 8, HttpUnit JUnit Tutorial for Unit Testing. 4. However if you’re a programmer who just got the job to create functional or unit tests, you’ll find HttpUnit a much more enjoyable and programmer-friendly toolkit. HttpUnit allows us to test navigating through our JSPs by clicking links and buttons and filling out forms. In this tutorial, we will explain.

Author: Saran Mikarn
Country: Burma
Language: English (Spanish)
Genre: Life
Published (Last): 14 March 2013
Pages: 260
PDF File Size: 14.15 Mb
ePub File Size: 4.6 Mb
ISBN: 520-4-97465-388-2
Downloads: 81646
Price: Free* [*Free Regsitration Required]
Uploader: Nikozragore

This tutorial shows you how to use HttpUnit to test your web applications.

Your Page Title

HttpUnit enables the programmers to write the test script htpunit test web applications. This tool is based on Unit which is also Java based free testing tool. HttpUnit emulates the functionality of the web browser, including the form submission, http authentication, cookies, Java Scripts and the Java API to examine the returned page.


HttpUnit is freely available on the sourceforge. Extract the downloaded file into your favorite directory. Create learnhttpunit at your favorite place and create lib directory in it.

Testing Web Applications with HttpUnit (Don’t worry, it’s not boring!)

To use HttpUnit put httpunit. For my example I have created lib directory under learnhttpunit directory and copied the content of lib and jars directory into it. I have created a bat file addtoppath. Now I will show you how to tutorizl your first program use HttpUnit to access the content of a jsp file.

5.10 Submitting Form Data

Httpunnit this example we will develop a program to access the JSP file from tomcat server running locally. Create a JSP file file example1.

Open web browser and type http: To compile and test the example go to learnhttpunit directory and execute addtopath. You should see the following output. In order to maintain the conversation state Cookies, Session, Windows with the web server WebConversation class httpunif used.


First of all it is necessary to create an object of this class to maintain the state with the server and play the role of web browser.

For this create another jsp file example2. About Privacy Policy Contact.

Architecture of HttpUnit HttpUnit consists of two core components: API to Analyze the the response content: This component is responsible acting on the response contents.

Downloading HttpUnit HttpUnit is freely available on the sourceforge. Welcome to the example 1. I am Example 1 Page content is: