[Kmymoney-devel] CSV Importer Plugin

Thomas Baumgart thb at net-bembel.de
Mon Feb 22 15:15:59 CET 2010

On Monday 22 February 2010 14:23:07 Alvaro Soliverez wrote:
> On Mon, Feb 22, 2010 at 10:07 AM, aga <aganderson at ukonline.co.uk> wrote:
> >> > I've been doing a bit of reading up, and yes, I can see that.
> >> >  Already, I've had to do a bit of redesign to allow testing.  Plus,
> >> > I'm going to have to move some error messages for the same reason.
> >> >
> >> > Just thinking ahead slightly, so far I've been working on a
> >> > free-standing version so as to get a simple executable and not mess
> >> > things up in the process.  What I'm unclear on is integrating back
> >> > into KMM.
> >> >
> >> > Is it something like 'make test' and then run as normal, or what?
> >>
> >> To run the tests, you have to enable the tests in cmake or ccmake.
> >> Then, you make and make install, as usual, and finally you run make test
> >
> > Thanks for that.
> >
> > Sorry, but a couple more queries.
> >
> > Firstly, to do with testing.  I've concentrated so far on my date
> > conversion routine, and I've been throwing a bunch of good and bad date
> > formats at it. If a valid date is found, I can unit  test against the
> > expected output. However, if an invalid date is found, not by unit test,
> > but by the checking routine, the error return just bypasses the unit test
> >  ASSERT test.  Is that the proper way to handle a program detected error,
> > or what?
> For these cases, you have to decide how you want to handle exceptions.
> Usually, for these cases, the wrong dates are an expected error, so
> you should check that before even reaching the ASSERT clauses, and
> fail gracefully, warning the user.
> You could throw a MYMONEYEXCEPTION, that your plugin catches and then
> displays a message to the user. In the unit tests, you catch that too,
> and add an assert to verify that the proper exception was thrown.
> Are you familiar with try/catch statements?

MyMoneyTransactionTest::testAddSplits() might serve as an example. It has 
both, checking for no exception to occur and for an exception to occur.



Thomas Baumgart

GPG-FP: E55E D592 F45F 116B 8429   4F99 9C59 DB40 B75D D3BA
If a cluttered desk is characteristic of a cluttered mind,
what does an empty desk mean ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 224 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kmymoney-devel/attachments/20100222/c2a3bc0b/attachment.sig 

More information about the KMyMoney-devel mailing list