[Interest] FW: TDD in QML

Ben Lau xbenlau at gmail.com
Mon May 5 10:35:42 CEST 2014

In fact, it is quite troublesome to do TDD over QML. Although Qt has
provided the Qt Quick Test module, it don't support dummydata  like Qt
Quick Designer. I have tried to run tst_xxx.qml via the C++ test framework
but it can not use the TestCase object. It depends on QTestRootObject which
is a private class.

So now I could only use Qt Quick Test to test module which don't relay on
context object . For other module , I would let the C++ test framework to
setup an environment with dummydata loaded , then execute the QML module.
However, it just used as a gallery of widget . It show how the component
looks and the interaction with user. It will report if there any error
raised during execution . No any detailed tests are carried.

On 5 May 2014 14:50, Luca Bonifacio <luca.bonifacio at bbv.ch> wrote:

> Hi guys
> Is there somebody which has some experiences by doing TDD with QML? How do
> you mock QML components?
> -----Original Message-----
> From: Alan Alpert [mailto:416365416c at gmail.com]
> Sent: Samstag, 3. Mai 2014 01:30
> To: Luca Bonifacio
> Subject: Re: [Interest] Project structure for multi-platform mobile devices
> On Fri, May 2, 2014 at 5:47 AM, Luca Bonifacio <luca.bonifacio at bbv.ch>
> wrote:
> > Hi Alan
> >
> > Thank you for your answer. Yes, that's correct. I could write a new
> component with the same name as the object in C++, but then I have the
> disadvantage that all those files are stored together my application source
> files, which isn't so nice. I would prefer to mock the C++ objects from my
> unit test project. Do you have already used TDD on complex projects? If
> yes, how do you do that?
> The dummydata files can be anywhere, as long as they're in one directory.
> Obviously, if you mock the C++ objects in C++ instead of QML then they
> exist near your custom test launcher.
> There was another guy who was doing TDD with QML on complex projects.
> But since you replied to me, and not the interest list, it will be hard
> for him to provide his feedback.
> --
> Alan Alpert
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140505/de37f4f4/attachment.html>

More information about the Interest mailing list