crash course in unittests

Lionel Elie Mamane lionel at mamane.lu
Sat Aug 3 08:36:08 PDT 2013


Thanks for these pointers. I think I mostly got it, but it fails for
me, and not at the place I expected it to.

Could you please take a look at branch private/lmamane/basetest ?

It contains:

 commit d965888eb4a0be4c0bdd33fb0b401546de48af0b
 Author: Lionel Elie Mamane <lionel at mamane.lu>
 Date:   Sat Aug 3 10:50:14 2013 +0200

    proposed changes to other unittests

    Change-Id: I64769fee917c5d8c6450a19ad53fdf795e280c98

Just things I found weird in existing tests I took inspiration of, but
before pushing to master, want a quick check by you.

Then it contains:

 commit bbcc93b3ad2eec0a717b5c59053519cc668cb27b
 Author: Lionel Elie Mamane <lionel at mamane.lu>
 Date:   Sat Aug 3 10:49:41 2013 +0200

    first stab at unittest for fdo#67685

    Change-Id: I44500717109a026d7c71e6494daacbea1f224263

Which is the unittest I wanted to add, but it does not work. It fails
at:

Test name: DialogSaveTest::test
assertion failed
- Expression: xComponent.is()
- loading failed:
file:///home/master/src/libreoffice/workdirs/master/dbaccess/
qa/extras/testdocuments/testDialogSave.odb

Dunno what wrong. Thanks in advance for your help.


On Sat, Aug 03, 2013 at 02:35:49AM +0200, Markus Mohrhard wrote:
> Hey Lionel,
> 
> So you basically have two options. We already have a test concept where we
> open a file and execute a basic macro in it. You can find an example for it
> in sc/qa/extras/macros-test.cxx
> 
> The other more flexible option is that you open a document and call the uno
> calls yourself from c++. The advantage of the second option is that it
> allows to add additional assertions and easier debugging but it takes a bit
> more code.
> 
> Regards,
> Markus
> On Aug 2, 2013 5:59 PM, "Lionel Elie Mamane" <lionel at mamane.lu> wrote:
> 
> > I'd appreciate some help in writing a unittest (subsequenttest?) for
> > https://bugs.freedesktop.org/67685
> >
> > It is the second time such a bug crops up, I'd like to prevent it.
> >
> > Basically, we "just" need to open an .odb file, run a Basic macro (we
> > can set it to autorun on document load), then save the file, and
> > inspect the result.
> >
> > Thanks in advance!
> >
> > --
> > Lionel


More information about the LibreOffice mailing list