Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q 4 Mr. Hunt & Mr Thomas (2): web apps & unit tests

 
Gian Franco
blacksmith
Ranch Hand
Posts: 979
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear authors,

I'm working on more than one web application based on different
frameworks. I would like to create a single test suite.

Does your book also give an indication of how I could create framework-
agnostic models (both boundaries and entities) that would allow me
to create a single suit of unit tests that can cover all of them?

Since the subtitle of your book is "In Java with JUnit" does this mean
that for web applications on different frameworks the testing would
regard only the java part?

Best regards,

Gian Franco Casula
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet at testing web applications is two-fold:
1) Test as much of the code with plain JUnit outside of the web container. Mock objects can help you with testing the boundaries with dependencies to javax.servlet.* etc.
2) Use a functional testing tool such as HttpUnit, JWebUnit, or Jameleon to exercise your web application "for real".
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:
1) Test as much of the code with plain JUnit outside of the web container. Mock objects can help you with testing the boundaries with dependencies to javax.servlet.* etc.

Fully agreed. You should also have as few classes as possible know about javax.servlet.* at all.

2) Use a functional testing tool such as HttpUnit, JWebUnit, or Jameleon to exercise your web application "for real".

FitNesse would be my tool of choice...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ilja Preuss:
FitNesse would be my tool of choice...
I keep on forgetting Fit(Nesse) from the list...
launches Eclipse to add a testContainsFitNesse() method to FunctionalTestingToolListTest.java...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic