<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Thanks for your answer Cristian. I understand what you mean, but I have no idea about how to check that those signals are emitted since I have never worked with this mechanism. Could you please show me a specific example?<br><br>Your answer refers to m_valueChangedSet and m_balanceChangedSet. Any ideas about the faults involving "m_balanceCache"?<br><br><div>> Date: Tue, 17 Feb 2015 16:23:42 +0200<br>> Subject: Re: [Kmymoney-devel] Improving the test suite for MyMoneyFile<br>> From: onet.cristian@gmail.com<br>> To: pedretti_86@hotmail.com<br>> CC: kmymoney-devel@kde.org<br>> <br>> Hi,<br>> <br>> Since those two members are used to implement the emit of the<br>> 'balanceChanged()' and 'valueChanged()' signals after committing<br>> changes you could write a test case that asserts that those signals<br>> are emitted properly.<br>> <br>> For example:<br>> After adding a transaction 'balanceChanged()' should be emitted.<br>> After adding a price 'valueChanged()' should be emitted.<br>> <br>> Regards,<br>> Cristian<br>> <br>> 2015-02-17 16:13 GMT+02:00 victor <pedretti_86@hotmail.com>:<br>> > Hello,<br>> ><br>> > I am trying to improve some of the test files of KMyMoney for my research<br>> > studies. This is a really complex task when you are not involved in<br>> > programming this application, so I need your help to achieve it.<br>> ><br>> > All the same, I'm only focusing on some specific parts. What I'm doing is to<br>> > introduce several concrete faults into the code and then observe if the<br>> > fault is detected by the test suite (this would be the expected of an<br>> > adequate test suite, but we all now that this is quite difficult sometimes).<br>> > In this sense, I have been doing this in "mymoneyfile.cpp" and testing it<br>> > with its corresponding file test "mymoneyfiletest.cpp". The faults<br>> > introduced are faults which are common when programming because we sometimes<br>> > mix the name of variables of the same type, or do not call the appropriate<br>> > method because of "copy and paste",...<br>> ><br>> > Here I show two of these faults that the test suite is not able to detect<br>> > (the result is the same in the original program and with the inserted<br>> > fault):<br>> ><br>> > 1) The first is in the method "void MyMoneyFile::commitTransaction(void)",<br>> > where I change:<br>> ><br>> > d->m_balanceChangedSet.remove((*it).id());<br>> ><br>> > by:<br>> ><br>> > d->m_valueChangedSet.remove((*it).id());<br>> ><br>> > Exactly the same happens in the method "void<br>> > MyMoneyFile::rollbackTransaction(void)" if, for instance, I change<br>> > "d->m_valueChangedSet.clear();" by "d->m_balanceChangedSet.clear();". These<br>> > changes seem to be meaningful changes, but they are not detected by the test<br>> > suite at the moment.<br>> ><br>> > 2) The other situation that I want to report is in method "void<br>> > notify(void)" belonging to "MyMoneyFile::Private". If I change,<br>> ><br>> > m_balanceCache.clear(i.first, i.second);<br>> ><br>> > by:<br>> ><br>> > m_balanceCache.clear(i.first);<br>> ><br>> > or:<br>> ><br>> > m_balanceCache.clear();<br>> ><br>> > How could I detect that I are not calling the method "clear" in a correct<br>> > way?<br>> ><br>> > I am aware that this is quite specific and may be difficult to create test<br>> > cases for these situations, but I think that this is a very good chance to<br>> > improve the test suite of MyMoneyFile (a very important module in the<br>> > application).<br>> ><br>> > Does somebody know how to reveal the aforementioned faults modifying<br>> > existing test cases or designing a new one?<br>> ><br>> > Thanks in advance.<br>> ><br>> > _______________________________________________<br>> > KMyMoney-devel mailing list<br>> > KMyMoney-devel@kde.org<br>> > https://mail.kde.org/mailman/listinfo/kmymoney-devel<br>> ><br></div>                                      </div></body>
</html>