Announcement Announcement Module
Collapse
No announcement yet.
Help in testing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help in testing

    Hello, reading documentation of Spring, i have read a point that says:

    "As the leading full-stack Java/J2EE application framework, Spring delivers significant benefits for many projects, reducing development effort and costs while improving test coverage and quality."

    Reducing development is obviously because no singleton or factories have to be implemented, also IoC, integration of hibernate, ... but can anybody explain me how is possible to improve test coverage and quality?

    Thank you very much.

  • #2
    well, the product quality increases, 'cos the ammount of code to be tested goes down That gives you an oportunity to focus only on testing of your business code.

    Comment


    • #3
      Originally posted by mag_gandalf
      Reducing development is obviously because no singleton or factories have to be implemented, also IoC, integration of hibernate, ... but can anybody explain me how is possible to improve test coverage and quality?
      There are a couple of *excellent* threads on this subject, but I can only find one of them...http://forum.springframework.org/sho...t+test+benefit

      Anyway, in summary unit tests are improved because IoC prevents (too strong a word but...) classes instantiating their own classes, rather they are passed in. Classes also work against interfaces, not implementations.
      This allows you to unit test that class by providing mock implementations.

      Assume classA requires an implementation of dao to do some work, previously you might have had classA do jndi.lookup("dao"), which would have made classA impossible (or very difficult) to unit test. Now, when you construct classA you provide the dao, so when you want to unit test you can very easily provide a mock dao.

      As a result your classes tend to become smaller and focused on a single thing, thus making them easier to unit test.

      To be clear; IoC doesn't *force* you to unit test, but a side effect of using IoC makes them easier.

      I wish I could find that other thread

      Comment

      Working...
      X