New way for non coders to help with calc unit tests

Hello guys,

I want to present you the new way you can write build-time unit tests for
calc.
*
How are the tests organized?*

The tests are located in sc/qa/unit and consists of filters-test.cxx and the
files in sc/qa/unit/data. In the data directory there is one directory per
supported file extensions (ods, xls, xlsx) and one directory contentCSV that
only contains csv files. Please don't touch the other directories, they are
for special tests) At the moment we have a for-named-ranges test, a database
ranges test , a formatting test and a standard content test file.
Additionally there is one file per directory for bugfix tests so that import
bugs that are fixed once will not reoccur. If possible a new test case
should be added to each of the three directories so that we test as much as
possible for every filter.
*
What can we test?*

We can test the content of a calc document directly after loading it. It is
quite easy to test the content of cells, that means the formula in a cell,
the result as a value and the formatted result as a string. It is even
possible to test the result of cells that are part of conditional
formatting. It gets more complicated for other stuff since I don't have any
csv handler for that or it might need some code to test it.

We can't test any dynamic changes in calc documents with this test ( there
is ucalc for these cases). So for unit tests that try to emulate user input
and/or changes that go beyond what is done during loading, can't be tested
with this easy unit test.

*
How to write a new test?*

It's quite easy to write a new unit test.
     The first step is to create a document that should be tested or
add/extend an existing sheet in a document.
     The second step is to create for every sheet a csv file that contains
the expected result, formula or string that the test document should
contain.

*How can I get the existing files?*

Either you have the source code already than it is in sc/qa/unit or you can
get the files from:
http://cgit.freedesktop.org/libreoffice/core/plain/sc/qa/unit/data

I will create a wiki page for these information soon but feel free to ask me
anything or make suggestions. I try to announce changes around this on the
QA list.

It would be amazing if some of the calc users would write or extend the
existing tests. Even if you could provide just one or two test cases you
would help very much ensure that our next release will contain less bugs and
that calc becomes even more stable.
Here are somethings, for instance, that could be tested or
the test extended:
     - normal content
     - data pilot/pivot table
     - the functions document should be extended to all build-in functions (
testing special cases, normal behaviour, etc. )
     - advanced functions like sorted content, autofilter, subtotals,
scenarios, etc.
     - some of the import bugs fixed during the 3-4 release cycle

I'm sure I missed a lot of important things and that is your big chance! Did
you ever wanted to commit something to Libreoffice source code but you don't
know how to code ? You don't have the time to get familiar with the code ?
This is the perfect opportunity to get your first commit :wink: You have a nasty
bug that you don't want to see again ? Write a test file, add a csv file
with the expected content and send it to the
libreoffice-qa@lists.freedesktop.org list.

I'm looking forward to all your great contributions that will help us to
release a nice next version.

Regards,
Markus

P.S. Links to all ods documents that we have at the moment:

http://cgit.freedesktop.org/libreoffice/core/plain/sc/qa/unit/data/ods/bug-fixes.ods

http://cgit.freedesktop.org/libreoffice/core/plain/sc/qa/unit/data/ods/database.ods

http://cgit.freedesktop.org/libreoffice/core/plain/sc/qa/unit/data/ods/formats.ods

http://cgit.freedesktop.org/libreoffice/core/plain/sc/qa/unit/data/ods/functions.ods

http://cgit.freedesktop.org/libreoffice/core/plain/sc/qa/unit/data/ods/named-ranges-global.ods

http://cgit.freedesktop.org/libreoffice/core/plain/sc/qa/unit/data/ods/universal-content.ods

Hi Markus,

Thanks for the heads up and the work on preparing the ground and basics
for what I hope will be a very useful addition to the unit testing of
LibreOffice. Although I'm not much of a Calc user myself, I will have a
look at what has been prepared and see if I can add anything useful.

Thanks once again to everyone who worked on this.

Alex