JUnit Tests

George_H
2011-10-01
2012-09-11
  • George_H

    George_H - 2011-10-01

    I've been inspired lately to add automated unit tests using JUnit.

    I actually wanted to do this from a long time and now I got the free time.

    The main test suite is in the "Test" source folder. For now I a started coding
    the test classes for all the VCardTypes, then we'll move on to all the other
    classes. So everything will have some sort of validation and quality
    assurance.

    The most difficult tasks will be creating the unit tests for the parser and
    the writer. As cam be seen in my current types test that I choose a certain
    convention for making and naming the tests. Each test should be highly
    localized to testing 1 function. The name of the method must start with "test"
    and continue with the name of the method that is being tested, and appended to
    the end some sort of special condition if needed.

    All tests should be added to the CardmeTestSuite class where JUnit can run
    everything in 1 go.

    With the current tests that I've added, i've found out that some tests fail on
    extended types and also calendar was parsing for floats instead of double. So
    unit tests are useful after all ;)

    Any one wants to contribute unit tests please use the patches tracker and
    attach the class files. Thanks.

     
  • George_H

    George_H - 2011-10-01

    Oh yeah forgot to add that later when the unit tests are done, I'll be making
    a proper build.xml file that will test, compile, package and release the
    library automatically. Whoever wants to do the same with Maven or any other
    one can feel free to do so and post the patch :)

     
  • Michael Rimov

    Michael Rimov - 2011-10-03

    Awesome to have!

    Re: Putting everything in CardmeTestSuite -- since, ant, maven, and eclipse
    can run everything at once in test//Test., it might make it a tad easier
    if we skip the "register it in the test suite" step.

    Re: Maven: I believe I'm 95% there -- the only thing missing is the deploy
    settings... it'll already do an automatic build/test and package.

     
  • George_H

    George_H - 2011-10-04

    The CardmeTestSuite was just a standard way I normally do things, I tend to
    use it often. Though I do plan on making a build.xml file to do the testing.

    As for Maven, I've never used it before so if you want maven support just
    submit what files I need to include. Does it need any special libs to run or
    something? I tried blindly running the POM and I got a bunch of errors.

     
  • George_H

    George_H - 2011-10-04

    All unit tests testing all the vcard Types are done. There are now a total of
    299 tests and they all pass.

    Next up come the real challenge, the parser and writer tests.

     

Log in to post a comment.