Results 1 to 3 of 3

Thread: Help in testing

  1. #1
    Join Date
    Apr 2006
    Posts
    110

    Default 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. #2
    Join Date
    Dec 2005
    Posts
    269

    Default

    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.

  3. #3
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    Quote 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •