This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Testing and the fly likes Q 4 Mr. Hunt & Mr Thomas (2): web apps & unit tests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Q 4 Mr. Hunt & Mr Thomas (2): web apps & unit tests" Watch "Q 4 Mr. Hunt & Mr Thomas (2): web apps & unit tests" New topic
Author

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

Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
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


"Eppur si muove!"
Lasse Koskela
author
Sheriff

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


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
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...


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
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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...
 
 
subject: Q 4 Mr. Hunt & Mr Thomas (2): web apps & unit tests
 
Similar Threads
Coverage of the book
JUnit in Action questions
This weeks book Giveaway:
Q 4 Mr. Ford (8): frameworks & (unit) test suites
Simple Spring Junit -