<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - calc unit test writing"
href="https://bugs.freedesktop.org/show_bug.cgi?id=39749#c5">Comment # 5</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - calc unit test writing"
href="https://bugs.freedesktop.org/show_bug.cgi?id=39749">bug 39749</a>
from <span class="vcard"><a class="email" href="mailto:markus.mohrhard@googlemail.com" title="Markus Mohrhard <markus.mohrhard@googlemail.com>"> <span class="fn">Markus Mohrhard</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=39749#c4">comment #4</a>)
<span class="quote">> Hi
>
> I am a student at clemson university, and I would really really like to
> contribute on this one.This is my first interaction with any open source
> project. I have worked on personal C++ projects, and have good grip on
> language. The following link mentioned in first comment -
> <a href="http://comments.gmane.org/gmane.comp.documentfoundation.libreoffice.qa/42">http://comments.gmane.org/gmane.comp.documentfoundation.libreoffice.qa/42</a>
> says "No such message".
>
> So far:
>
> 1. I have downloaded and build libreoffice.
>
> 2. I have looked into "sc/qa/unit/" folders and tried to understand already
> built unit tests.
>
> 3. I understand that the "helper" folder contains the handler files which
> loads csv test data (from "data" folder) and run thesetests.</span >
Great. These are already the most important steps.
<span class="quote">>
> 4. However, I am still not sure, how exactly these unit tests are run, where
> is the main function,how to load the data?. A little help or a link to
> document where this is explained would be of awesome help. My question is
> "How exactly do we run these unit tests?".</span >
They are controlled by the makefiles in sc/. sc/Module_sc.mk contains which
tests are actually included and the corresponding makefiles in sc/ how to build
them.
The main function is in sal/ inside the cppunittester applciation but we don't
touch that part of the code when we write tests. The cppunittester is included
into the test through the CPPUNIT_PLUGIN_IMPLEMENT macro and the remaining
cppunit macros register the tests in cppunit. More information abotu cppunit
can be found at <a href="http://people.freedesktop.org/~mmohrhard/cppunit/index.html">http://people.freedesktop.org/~mmohrhard/cppunit/index.html</a>
So most of the file loading is already abstracted and hidden behind some layers
in our testing framework. You need to follow the different class hierarchy that
goes into test/ and unotest/. Depending on the test we either use direct calls
to the Libreoffice code or use the public UNO API.
Taking sc/qa/unit/filters-test.cxx as an example and picking testRangeNameODS
which tests the import of range names from ODS. Test method is declared in line
63, added to the test suite in line 84, and definition starts in line 224. The
first call in that method loads the file and returns the corresponding
ScDocShell (an internal representation of a calc document).
Sadly there is not much documentation except for
<a href="https://wiki.documentfoundation.org/Development/Calc_Import_Unit_Tests">https://wiki.documentfoundation.org/Development/Calc_Import_Unit_Tests</a> which I
wrote when i first implemented the csv based document comparison. Most of this
page should still be correct.
<span class="quote">>
> I really intent to contribute and learn. I am a quick learner, and I really
> find it interesting. I would really appreciate some pointers. Like where
> exactly the class files located, for which we are building test cases?, some
> example test cases for any other module we have.
> </span >
So these are not real unit tests and we don't test single classes. You can call
it regression testing or integration testing. Basically we normally try to test
the correct interaction of larger pieces of the code. Testing single classes is
nearly never possible in our code base. There are some exceptions for lower
levels where we have real unit tests (also the sc_rangelst_test does something
similar). So normally we test parts of sc/source/core or sc/source/filter or
both together.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>