File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Junit v&s Http Unit" Watch "Junit v&s Http Unit" New topic

Junit v&s Http Unit

Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
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...")

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

Joined: Jan 23, 2002
Posts: 11962
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
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

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:
subject: Junit v&s Http Unit
It's not a secret anymore!