[Kmymoney-devel] Improving the test suite for MyMoneyFile

victor pedretti_86 at hotmail.com
Tue Feb 17 14:13:33 UTC 2015


Hello,

I am trying to improve some of the test files of KMyMoney for my research studies. This is a really complex task when you are not involved in programming this application, so I need your help to achieve it.

All the same, I'm only focusing on some specific parts. What I'm doing is to introduce several concrete faults into the code and then observe if the fault is detected by the test suite (this would be the expected of an adequate test suite, but we all now that this is quite difficult sometimes). In this sense, I have been doing this in "mymoneyfile.cpp" and testing it with its corresponding file test "mymoneyfiletest.cpp". The faults introduced are faults which are common when programming because we sometimes mix the name of variables of the same type, or do not call the appropriate method because of "copy and paste",...

Here I show two of these faults that the test suite is not able to detect (the result is the same in the original program and with the inserted fault):

1) The first is in the method "void MyMoneyFile::commitTransaction(void)", where I change:

d->m_balanceChangedSet.remove((*it).id());

by:
 
d->m_valueChangedSet.remove((*it).id());

Exactly the same happens in the method "void MyMoneyFile::rollbackTransaction(void)" if, for instance, I change "d->m_valueChangedSet.clear();" by "d->m_balanceChangedSet.clear();". These changes seem to be meaningful changes, but they are not detected by the test suite at the moment.

2) The other situation that I want to report is in method "void notify(void)" belonging to "MyMoneyFile::Private". If I change, 

m_balanceCache.clear(i.first, i.second);

by:

m_balanceCache.clear(i.first);

or:

m_balanceCache.clear();

How could I detect that I are not calling the method "clear" in a correct way?

I am aware that this is quite specific and may be difficult to create test cases for these situations, but I think that this is a very good chance to improve the test suite of MyMoneyFile (a very important module in the application). 

Does somebody know how to reveal the aforementioned faults modifying existing test cases or designing a new one?

Thanks in advance. 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150217/40264708/attachment.html>


More information about the KMyMoney-devel mailing list