Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.0
    • Component/s: None
    • Labels:
      None

      Description

      Patch, which incorporates Unit Testing into James project infrastructure.
      Since there was no reaction on the dev-list since I proposed it a few days ago, I'm uncertain if this is appreciated at all.

      I think unit testing could become vital for
      + helping QA
      + supporting refactorings (e.g. relaxing avalon dependencies)
      + testing while implementing new features (like IMAP)
      + reproducing bugs
      + testing fixes

      I know that it's a long way to go to reach very good test-coverage.
      But there is no risk in starting.
      My determination would be to add 2 to 3 test methods per week.

      It already helped me a lot understanding how parts of James work, although this is only my first test for this codebase.

      The patch utilizes JUnit 3.8.1 (junit.jar) and Ristretto (ristretto-1.0-all.jar, can be found under http://columbo.sourceforge.net) which the build script expects to find under /tools/lib but which are not attached here in the first place.

      tests are compiled and run invoking > build run-unit-tests

      I'd feel more than happy about comments how to improve this testing infrastructure.

      1. unittest.txt
        38 kB
        Bernd Fondermann
      2. unittest1.2.patch
        53 kB
        Bernd Fondermann
      3. unittest2.0.patch
        98 kB
        Bernd Fondermann
      4. unittest3.0.patch
        37 kB
        Bernd Fondermann
      5. unittest4.0.patch
        46 kB
        Bernd Fondermann
      6. unittest5.0.patch
        4 kB
        Bernd Fondermann
      7. unittest6.0.patch
        9 kB
        Bernd Fondermann
      8. website.patch
        0.9 kB
        Bernd Fondermann

        Activity

        Hide
        bago Stefano Bagnara added a comment -

        junit is licensed under the CPL
        ristretto is licensed under the MPL/GPL/LGPL triple license.

        Does anyone know wether we can add them to our james repository or not?

        If not, what should we do?

        I really like this effort to start testing james.

        Show
        bago Stefano Bagnara added a comment - junit is licensed under the CPL ristretto is licensed under the MPL/GPL/LGPL triple license. Does anyone know wether we can add them to our james repository or not? If not, what should we do? I really like this effort to start testing james.
        Hide
        brainlounge Bernd Fondermann added a comment -

        some more tests. it replaces the last attachment.

        Show
        brainlounge Bernd Fondermann added a comment - some more tests. it replaces the last attachment.
        Hide
        bago Stefano Bagnara added a comment -

        Cool, I was just looking at your work, trying to change the build.xml to automatically download the junit and ristretto jars so we can avoid to commit them and re-distribute them.

        Show
        bago Stefano Bagnara added a comment - Cool, I was just looking at your work, trying to change the build.xml to automatically download the junit and ristretto jars so we can avoid to commit them and re-distribute them.
        Hide
        brainlounge Bernd Fondermann added a comment -

        Stefano, your worthwhile Mail/MailImpl refactoring broke the patch.
        Nevertheless, I expect that it will ease unit testing a lot.
        I'll refactor and resubmit the patch.

        Show
        brainlounge Bernd Fondermann added a comment - Stefano, your worthwhile Mail/MailImpl refactoring broke the patch. Nevertheless, I expect that it will ease unit testing a lot. I'll refactor and resubmit the patch.
        Hide
        brainlounge Bernd Fondermann added a comment -

        fixed and extended unit tests.
        this attachement replaces all prev attached files.

        Show
        brainlounge Bernd Fondermann added a comment - fixed and extended unit tests. this attachement replaces all prev attached files.
        Hide
        bago Stefano Bagnara added a comment -

        I commited your 2.0 patch plus a few tests from me. I haven't committed the required libraries by now because I'm not sure about the licensing issues, but I wanted to commit the tests so we finally start writing more of them!
        IMHO tests are a major requirement to move safely to James 3.0.

        Show
        bago Stefano Bagnara added a comment - I commited your 2.0 patch plus a few tests from me. I haven't committed the required libraries by now because I'm not sure about the licensing issues, but I wanted to commit the tests so we finally start writing more of them! IMHO tests are a major requirement to move safely to James 3.0.
        Hide
        brainlounge Bernd Fondermann added a comment -

        Wow. Thank you, Stefano.

        Show
        brainlounge Bernd Fondermann added a comment - Wow. Thank you, Stefano.
        Hide
        brainlounge Bernd Fondermann added a comment -

        + fixed/improved existing tests
        + added new tests
        + added tools/lib/commons-net-1.4.1.jar, not included in this patch (used for Telnet-ing into RemoteManager)
        + changed build.xml to continue running remaining tests on error/failures
        + all tests pass, except MailServerTestAllImplementations.testGetNonexistingUserInbox()

        note: detailed test reports can be found in build/test/reports after running the tests

        Show
        brainlounge Bernd Fondermann added a comment - + fixed/improved existing tests + added new tests + added tools/lib/commons-net-1.4.1.jar, not included in this patch (used for Telnet-ing into RemoteManager) + changed build.xml to continue running remaining tests on error/failures + all tests pass, except MailServerTestAllImplementations.testGetNonexistingUserInbox() note: detailed test reports can be found in build/test/reports after running the tests
        Hide
        bago Stefano Bagnara added a comment -

        I fixed the NPE in James (I think we want to return null instead of NPE) and fixed the non working test according.
        Thank you again,
        Stefano

        Show
        bago Stefano Bagnara added a comment - I fixed the NPE in James (I think we want to return null instead of NPE) and fixed the non working test according. Thank you again, Stefano
        Hide
        brainlounge Bernd Fondermann added a comment -

        some more tests

        Show
        brainlounge Bernd Fondermann added a comment - some more tests
        Hide
        brainlounge Bernd Fondermann added a comment -

        adds info to the website, how to execute the tests (but we still need to give information about the not contained libraries)

        Show
        brainlounge Bernd Fondermann added a comment - adds info to the website, how to execute the tests (but we still need to give information about the not contained libraries)
        Hide
        brainlounge Bernd Fondermann added a comment -

        changed the assignment of tests ports from random to incremental

        Show
        brainlounge Bernd Fondermann added a comment - changed the assignment of tests ports from random to incremental
        Hide
        brainlounge Bernd Fondermann added a comment -

        MailetLoader unit tests

        Show
        brainlounge Bernd Fondermann added a comment - MailetLoader unit tests
        Hide
        bago Stefano Bagnara added a comment -

        Aplplied patches from 1 to 6.
        Next works by Bernd will be direclty committed, so this issue is no more needed.

        I have not committed website.patch because it was altering a 2_1 documentation file.
        We should create the new files for 2_2/2_3 before.

        Show
        bago Stefano Bagnara added a comment - Aplplied patches from 1 to 6. Next works by Bernd will be direclty committed, so this issue is no more needed. I have not committed website.patch because it was altering a 2_1 documentation file. We should create the new files for 2_2/2_3 before.
        Hide
        bago Stefano Bagnara added a comment -

        Bernd, I have a question (curiosity): have you considered the usage of commons-net objects (there are SMTPClients, POP3Clients and more) instead of the LGPL ristretto library for the protocol tests?

        Show
        bago Stefano Bagnara added a comment - Bernd, I have a question (curiosity): have you considered the usage of commons-net objects (there are SMTPClients, POP3Clients and more) instead of the LGPL ristretto library for the protocol tests?
        Hide
        brainlounge Bernd Fondermann added a comment -

        good question. I considered it but it seemed to me that ristretto is more complete/heayweight and thus less coding than commons-net. later when I did the RemoteManagerTest, I had to introduce commons-net anyway to use its telnet features.

        do you tend to migrate? i would not be oppose this.

        since you explicitly refer to the LGP license: I would propose (asking Columba develepors for) putting ristretto into ibiblio and download using maven.

        Show
        brainlounge Bernd Fondermann added a comment - good question. I considered it but it seemed to me that ristretto is more complete/heayweight and thus less coding than commons-net. later when I did the RemoteManagerTest, I had to introduce commons-net anyway to use its telnet features. do you tend to migrate? i would not be oppose this. since you explicitly refer to the LGP license: I would propose (asking Columba develepors for) putting ristretto into ibiblio and download using maven.
        Hide
        bago Stefano Bagnara added a comment -

        Maybe I will look at the conversion later: if it is easy I would like to reduce our dependencies to commons-net. Commons-net is an Apache project, so if features are similar we should try to stick to it.
        Thank you for the informations!

        PS: If I fail to find the time for this we'll follow the ibiblio way!

        Show
        bago Stefano Bagnara added a comment - Maybe I will look at the conversion later: if it is easy I would like to reduce our dependencies to commons-net. Commons-net is an Apache project, so if features are similar we should try to stick to it. Thank you for the informations! PS: If I fail to find the time for this we'll follow the ibiblio way!
        Hide
        danny@apache.org Danny Angus added a comment -

        Closing issue fixed in released version.

        Show
        danny@apache.org Danny Angus added a comment - Closing issue fixed in released version.

          People

          • Assignee:
            bago Stefano Bagnara
            Reporter:
            brainlounge Bernd Fondermann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development