• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Test driving QML

Test driving QML



How to test-drive your Qt QML code. Overview on how you do simple testing, UI level testing, synchronous testing, data-driven testing. ...

How to test-drive your Qt QML code. Overview on how you do simple testing, UI level testing, synchronous testing, data-driven testing.

These are the slides used on the Tampere MeeGo meetup on March 15, 2011 and text may not be super clear for those who didn't attend the meetup. You can still download the example and examine it.



Total Views
Views on SlideShare
Embed Views



46 Embeds 46,431

http://agilesoftwaredevelopment.com 41718
http://www.agilesoftwaredevelopment.com 3458
http://rocketcityhooligans.com 454
http://www.rocketcityhooligans.com 358
http://feeds.agilesoftwaredevelopment.com 137
http://translate.googleusercontent.com 79
http://codingthis.com 51
http://localasd 51
http://webcache.googleusercontent.com 23
http://asd-release 18
http://emulator.mobilewebsitesubmit.com 10
http://web.archive.org 7
http://www.hanrss.com 6
http://theoldreader.com 6
https://twitter.com 5
http://www.bing.com 5
https://teras.tieto.com 4
http://agilesoftwaredevelopment.com. 3
http://cache.baiducontent.com 2
http://www.linkedin.com 2
http://www.newsblur.com 2
http://us-w1.rockmelt.com 2
http://inoreader.com 2
http://admin.totalmarketing.com 2
http://www.google.com 2
http://localhost 2
http://static.slidesharecdn.com 2
http://www.bluemini.com 2 1
http://www.netvibes.com 1
http://www.google.co.in 1
http://inc.appspot.com 1
http://scrum.collected.info 1
http://smashingreader.com 1
http://www.feedreader.com 1
http://www.inoreader.com 1
http://uk.search-results.com 1
http://ymb16 1
http://knowledgehubnetworks.com 1
http://fanyi.youdao.com 1
http://dashboard.bloglines.com 1
http://www.agile-tools.net 1
http://www.google.co.uk 1
http://www.agilesoftwaredevelopment.com. 1 1
http://pre-excursion16.veritise.com 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • Adding numbers continuously – property bindingChange color when result is over 1000 => .toString() when comparing complex built-in objectsMove to states. Change the default color
  • Increase font on mouseClick – when:windowShown

Test driving QML Test driving QML Presentation Transcript

  • Test-Driving QML
    Artem Marchenko
    March 15, 2011
  • Artem Marchenko
    Product Manager, Researcher, Coach
    Product Manager shipping multi-hundred MEur products
    Scrum Master, Practitioner, Product Owner and Coach
    Three times Forum Nokia Champion
    Private entrepreneur
    Available for hire
  • Test-Driven Development. Or just testing QML
    What TDD is about
    Getting started
    Simple Synchronous test
    Simulating mouse and keyboard actions
    Asynchronous tests (verifying callbacks)
    Data-driven tests
    Current limitations
  • Test-Driven Development
    Remove duplication
  • Example of a QML-code developed via TDD
  • Getting started 1(3)
    git clone git://gitorious.org/qt-labs/qtest-qml.git
    Cloning into qtest-qml...
    remote: Counting objects: 888, done.
    remote: Compressing objects: 100% (669/669), done.
    remote: Total 888 (delta 445), reused 393 (delta 187)
    Receiving objects: 100% (888/888), 411.11 KiB, done.
    Resolving deltas: 100% (445/445), done.
    cd qtest-qml/
    make install
    make docs
    make check
    Project page: http://qt.gitorious.net/qt-labs/qtest-qml
  • Getting started 2(3)
    Create the simplest test in your project
  • Getting started 3(2)
    And a script that runs the test: runTests.sh in this case
    /Users/artem/QtSDK/Desktop/Qt/471/gcc/bin/QMLViewer.app/Contents/MacOS/QMLViewer tst_tddCalculator2.qml
  • Simple synchronous tests
  • UI level: simulating mouse click
  • UI level: simulating touch and drag
  • Asynchronous testing: tryCompare
  • Asynchronous testing: SignalSpy
  • Data-driven tests
  • Current Limitations
    Installation doesn’t install qtest-qml to QtCreator 2.1 Tech Preview
    Not that you would need it for TDD, but if you are into “just testing” already written code, debugger may be helpful
    Bug: only one TestCase is allowed: http://bugreports.qt.nokia.com/browse/QTBUG-17200
    It makes init() and cleanup nearly useless
    Organize your test structure by your own tools
    Small difficulties comparing built-in classes (e.g. color)
    toString() helps most of the time
  • Current limitations
    Very strange errors when object/property can be accessed e.g. because of a typo
    Segmentation faults, sometimes even “file not found”
    In 95% of cases that is a typo or an attempt to access a non-public property
  • Current limitations
    SignalSpy can only count
    It cannot examine the signal arguments or the state of other objects
    Benchmarking is a part of a qtest-qml, but doesn’t work properly
    That is I failed to make it run for a given amount of times (most of the time it does just a single run)
    No built-in device test runners
    Though you can certainly, embed a “run tests” button right into your application
  • Thank you
    Q&As time
    You can find these slides at http://agilesoftwaredevelopment.com/tags/tdd