Development/Calc Unit Test Concept

    From The Document Foundation Wiki

    New calc unit test concept

    We have two different type of unit test in calc: ucalc.cxx which links staticaly against calc and filters-test.cxx which links dynamicaly against calc.


    ucalc is used for testing dynamic changes and testing non exported methods and functions.


    filters-test is originally the unit test for filter code but can be used to test a lot more. After loading a file into calc we execute a full recalculation and some more automatic stuff.

    How to add new tests


    In ucalc you just add a new method and register it as new test.

    Some known limitations at the moment:

    • all methods in ScDocFunc that use ScEditableTester won't work
    • we have no XStorage behind our ScDocShell


    The filters test consists of two parts: the code in sc/qa/unit/filters-test.cxx and the test files in sc/qa/unit/data. We have some feature test files, universal-content and a bugFix test file. The bugFix test file should be used for all bug fixes that do not fit into an existing feature test file or would fit into universal-content. Universal-content should only contain some basic stuff that is supported in every important import filter(at the moment: ods, xls, xlsx). For every complex feature we should add an own testfile that is used to test this feature in detail.

    1. Create a test file to sc/qa/unit/data/[fileextension] or add a new sheet to an existing file.
    2. Either write some code for checking the result or put a csv file into sc/qa/unit/data/contentCSV
    test files
    1. universal-content
    2. named-ranges-global (also contains local range name tests)
    3. database
    4. formats
    5. matrix