wood burning stoves 2.0*
The moose likes Testing and the fly likes Junit v&s Http Unit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Junit v&s Http Unit" Watch "Junit v&s Http Unit" New topic
Author

Junit v&s Http Unit

Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
Hi,
I am facing a problem wherein the my test using HttpUnit are taking more time to complete than the JUnit Test cases.
I am using WebConversation to get the response for a request and then compare the request against a predefined text:
Response res = WebConverstaion.getResponse(request).

Where following code takes lesser time:
PostMethod pm = new PostMethod("http...")
HttpClient.execute(PostMethod).

Can anzbody help me in this regard. Any help will me in this regard.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
So what exactly is your problem? Can you accomplish what you need to do with the second (faster) approach?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
Hi,
The problem is i have used HttpUnit Testing to test the code.
Now it is taking more time compared to Junit. So i need to explain why HttpUnit is taking more time.Is it documented somewhere that HttpUnit is slower than Unit.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Well, HttpUnit actually does a lot more than just executing a post request. It parses the whole website; if it contains a frameset, it loads all subframes; if it contains javascript, it executes it as necessary etc. pp.

Take a look at its source code to see what happens behind the curtain - it's open source, after all!


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Junit v&s Http Unit
 
Similar Threads
Java with curl (http://curl.haxx.se/)
this urgent --question on struts
java.net.Connect Exception: Connection refused: connect
reason for EOF exception?
struts test case problem