Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Junit v&s Http Unit

 
Abhijit Sontakey
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what exactly is your problem? Can you accomplish what you need to do with the second (faster) approach?
 
Abhijit Sontakey
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic