[Request For Contribution] More tests needed

4 views
Skip to first unread message

Thomas Paviot

unread,
Aug 26, 2011, 6:52:21 PM8/26/11
to oce...@googlegroups.com
Dear all,

A testing framework was introduced in OCE-0.4.0. It is based upon CTest (http://www.vtk.org/Wiki/CMake_Testing_With_CTest, to perform tests) and googletest (http://code.google.com/p/googletest/, providing different kinds of ASSERT_*). A wiki entry (https://github.com/tpaviot/oce/wiki/Testing-suite) explains in a few words how to run these tests and export the results to http://my.cdash.org/index.php?project=OCE.

So far, only a few tests were added (around a dozain) but we actually do need more tests in order to ensure that our changes don't introduce any regression. Ideally, we should do unittesting, that is to say at least one test per function/method. It's impossible: there are thousands of methods/functions, it would take years. 10 tests is obviously not enough, thousands of unittests if not posible: an intermediate solution is to rely on a 'reasonable' set of tests. What does 'reasonable' mean? I would say: the minimum number of tests that maximize code coverage. A 'reasonable' goal, in a mid term, would be to provide around 5 tests per subfolder located in the /src folder: Standard, gp, Geom, math, ShapeFix etc. There are 493 such subfolders, leading to 2500 tests. Even with those 2500 tests, we could not ensure code quality at 100% (it's not our goal), but the probability that we introduce a regression would be very low if all tests pass.

You can help achieve this project. You all have, somewhere on your hard drives, examples/samples/snippets you developed to test OCCT. You can help by sharing these small tests so that they can be integrated into the project.

How? Many solutions:
- my favorite one: fork the OCE project on github and create pull requests when you want your tests to be merged into master
- alternate solution: copy/paste your test in the issue I created on github (https://github.com/tpaviot/oce/issues/90)
- the ugly one: reply this email (on oce-dev, or by private email) with the test attached and the related "category" (Standard, gp, Geom etc.)

The gtest usage is very simple. However, if ever you don't have time to refactor your test in a gtest way, I can do it, but please in that case insert comments into your code to clearly explain the expected behavior  (these comments will be converted to ASSERT_*).

Note 1: IMO a good test has to be as short as possible so that it's easy to figure out what's wrong if it fails. 20 lines should be a maximum.
Note 2: of course, only C++ tests are requested (no TCL, sorry ;-) ).

Thank you in advance for your contributions!

Best Regards,

Thomas

Reply all
Reply to author
Forward
0 new messages