[bt-devel] Using QTest with BibleTime

Gary Holmlund gary.holmlund at gmail.com
Mon Jul 25 16:01:03 MST 2016


Jaak,

Using QTest was one way of avoiding another dependency.

QTest also allows testing that correct signals are emitted (QSignalSpy) 
and that multiple dimensions of data could be supplies to some functions 
so they get tested with a variety of parameters (QTest::newRow, 
QTest::addColumn).

These are all in use in the test_cswordversekey.cpp file.

Still thinking about this.

Gary


On 07/25/2016 12:20 AM, Jaak Ristioja wrote:
> Do we even need an external framework at all? Basic testing can be done
> using plain and simple CMake and C++ code. Having another dependency
> might cause more issues than it solves.
>
> J
>
>
> On 25.07.2016 03:31, Gary Holmlund wrote:
>> Another possible framework I am familiar with is Google test. We used it
>> at work. It would certainly be a better choice for code that does not
>> have Qt (swordxx ?) and works fine with Qt code also.
>>
>> I will look into adding the tests to CI. I don't think it will be hard.
>>
>> Gary
>>
>>
>> On 07/24/2016 03:08 PM, Jaak Ristioja wrote:
>>> As a sidenote and not to start a discussion, I think that QTest is
>>> probably not the framework we want to be using in the long term.
>>>
>>> I'm also a bit sceptical whether anyone has much time to write tests,
>>> but when do you think you could integrate this with our CI? :-)
>>>
>>> J
>>>
>>> On 28.11.2015 15:12, Martin Gruner wrote:
>>>> This is excellent, Gary!
>>>>
>>>> Am 25.11.15 um 18:05 schrieb Gary Holmlund:
>>>>> I have started work on tests for BibleTime code using Qt QTest. The
>>>>> goal
>>>>> is to make it easy to automatically test code changes before they are
>>>>> checked in. Running the tests is done by typing "ctest" in the build
>>>>> directory. It will run all tests and provide a summary of the results.
>>>>>
>>>>> The best way to use these tests is for each developer to run them
>>>>> before
>>>>> checking in code. If an error occurs, that developer should either
>>>>> fix a
>>>>> bug they created, or modify the failing test if new behavior is
>>>>> expected.
>>>>>
>>>>> I have written tests for the public functions in CSwordBackend and
>>>>> CSwordVerseKey. I am ready to check these in. This is just a small
>>>>> start
>>>>> in the list of classes we should test. I would gladly like others to
>>>>> help in this process.
>>>>>
>>>>> So, is this a direction we want to take with BibleTime?
>>>>>
>>>>> Gary
>>>>>
>>>>>
>>>>> ============= More details =====
>>>>>
>>>>> bibletime/tests
>>>>>
>>>>> These directories are for tests of BibleTime classes and functions.
>>>>> They
>>>>> use
>>>>> the Qt test framework as described in Qt documentaion. See QTest and
>>>>> qtestlib.
>>>>>
>>>>> The tests for backend classes are not necessarily unit tests. Since
>>>>> many
>>>>> classes
>>>>> are wrappers around sword functionality, it seems best to test classes
>>>>> based
>>>>> on sword by including sword in the test program.
>>>>>
>>>>>
>>>>> Building
>>>>>
>>>>> The tests are automatically built in the build directory. They do not
>>>>> have to
>>>>> be installed to run.
>>>>>
>>>>>
>>>>> Running
>>>>>
>>>>> The tests currently require the following modules to be installed.
>>>>> KJV, KJVA, Scofield, Josephus, and StrongGreek
>>>>>
>>>>> Running all test programs and summarizing the results can be done by
>>>>> running
>>>>> "ctest" in the build directory. CMake provides the "ctest" program.
>>>>>
>>>>> Running an individual test for a specific class is done by running
>>>>> the test
>>>>> program for that class. This in normally "test_" plus the lowercase
>>>>> class name
>>>>> like test_cswordversekey.
>>>>>
>>>>>
>>>>> Errors
>>>>>
>>>>> If an error occurs with an existing test, either there is a problem
>>>>> in the
>>>>> BibleTime source or the test needs to be updated for the change in
>>>>> functionality.
>>>>> Please keep all tests passing.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>> _______________________________________________
>>> 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
>
> _______________________________________________
> 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