[bt-devel] refactoring::namespace

Troy A. Griffitts scribe at crosswire.org
Thu Jul 8 02:58:43 MST 2010


I hate writing tests...

but realized I write tests all the time when I'm doing development

cf. sword/tests/

So what we did was 'formalize' a testsuite from these already-written
little apps (and expanded the tests with very small modifications).

Here are the benefits and how things work:

Any little cpp program that outputs to stdout can be a test app.
testApp > testApp.good simply preserves successful output

Then all the tests can be run and the output is compared to their .good
files and any differences are reported.

It's a very simple system, no real investment if you don't keep it
around, and no real training for developers to start using.

Downside, it only runs on a system with /bin/sh

If interested, you can see our testsuite scripts under:

http://crosswire.org/svn/sword/trunk/tests/testsuite/

start with runall.sh

(I think I changed things recently that might make one of these tests
fail :)  )

fwiw,
    Troy




On 07/08/2010 02:18 AM, Martin Gruner wrote:
> So I guess you don't like the concept of "test driven development"?
>
> mg
>
> Am 08.07.10 09:34, schrieb Jaak Ristioja:
>   
>> On 08.07.2010 09:54, Martin Gruner wrote:
>>     
>>> I'd be more than grateful if you could also investigate on how we could
>>> implement a BibleTime::Test (unit tests for the backend at least). I
>>> tried at one point, but didn't get really far. So far I only have tests
>>> for the CBTConfig, which are really trivial, but better than nothing.
>>>       
>> See http://doc.trolltech.com/qttest.html and QTest class.
>>
>> For good examples (including GUI tests), see the source code of the
>> Arora browser at
>> http://code.google.com/p/arora/wiki/source and look into the
>> autotests/ folder for
>> automatic tests (and manualtests/ folder for simple programs used for
>> manual testing).
>>
>>     
>>> We need good unit testing support to be sure that refactoring efforts
>>> don't break things. Unfortunately I don't know how to do that in C++
>>> efficiently. The lack of this is a major problem in BT's codebase
>>>       
>> quality.
>>
>>     
>>> What do you think?
>>>       
>> I think we're nowhere near writing tests, except perhaps for a few
>> classes. Personally I
>> wouldn't want to try it right now and end up rewriting all the tests
>> later. I think we
>> should at this point concentrate on refactoring/documentation rather
>> than tests.
>>
>> Blessings!
>> Jaak
>>     
> _______________________________________________
> bt-devel mailing list
> bt-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/bt-devel
>
>
>
> _______________________________________________
> bt-devel mailing list
> bt-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/bt-devel
>   




More information about the bt-devel mailing list