SlideShare a Scribd company logo
1 of 18
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 http://fi.linkedin.com/in/artemmarchenko
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 Q&As
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/ qmakeqtest-qml.pro make 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 #!/bin/bash clear /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

More Related Content

What's hot

The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
intelliyole
 

What's hot (20)

Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4Best Practices in Qt Quick/QML - Part 1 of 4
Best Practices in Qt Quick/QML - Part 1 of 4
 
02 - Basics of Qt
02 - Basics of Qt02 - Basics of Qt
02 - Basics of Qt
 
Qt Qml
Qt QmlQt Qml
Qt Qml
 
Quickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop ApplicationsQuickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop Applications
 
QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong? QThreads: Are You Using Them Wrong?
QThreads: Are You Using Them Wrong?
 
Qt multi threads
Qt multi threadsQt multi threads
Qt multi threads
 
Kotlin for Android Development
Kotlin for Android DevelopmentKotlin for Android Development
Kotlin for Android Development
 
Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3Best Practices in Qt Quick/QML - Part 3
Best Practices in Qt Quick/QML - Part 3
 
Qt for beginners part 1 overview and key concepts
Qt for beginners part 1   overview and key conceptsQt for beginners part 1   overview and key concepts
Qt for beginners part 1 overview and key concepts
 
Unit testing with Qt test
Unit testing with Qt testUnit testing with Qt test
Unit testing with Qt test
 
In-Depth Model/View with QML
In-Depth Model/View with QMLIn-Depth Model/View with QML
In-Depth Model/View with QML
 
Best Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIBest Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part III
 
Best Practices in Qt Quick/QML - Part II
Best Practices in Qt Quick/QML - Part IIBest Practices in Qt Quick/QML - Part II
Best Practices in Qt Quick/QML - Part II
 
Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7Qt and QML performance tips & tricks for Qt 4.7
Qt and QML performance tips & tricks for Qt 4.7
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Qt Application Programming with C++ - Part 1
Qt Application Programming with C++ - Part 1Qt Application Programming with C++ - Part 1
Qt Application Programming with C++ - Part 1
 
The Kotlin Programming Language
The Kotlin Programming LanguageThe Kotlin Programming Language
The Kotlin Programming Language
 
Qt Design Patterns
Qt Design PatternsQt Design Patterns
Qt Design Patterns
 
Ndc2014 시즌 2 : 멀티쓰레드 프로그래밍이 왜 이리 힘드나요? (Lock-free에서 Transactional Memory까지)
Ndc2014 시즌 2 : 멀티쓰레드 프로그래밍이  왜 이리 힘드나요?  (Lock-free에서 Transactional Memory까지)Ndc2014 시즌 2 : 멀티쓰레드 프로그래밍이  왜 이리 힘드나요?  (Lock-free에서 Transactional Memory까지)
Ndc2014 시즌 2 : 멀티쓰레드 프로그래밍이 왜 이리 힘드나요? (Lock-free에서 Transactional Memory까지)
 
Introduction to QML
Introduction to QMLIntroduction to QML
Introduction to QML
 

Similar to Test driving QML

Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
elliando dias
 
Drupalcamp Simpletest
Drupalcamp SimpletestDrupalcamp Simpletest
Drupalcamp Simpletest
lyricnz
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
 

Similar to Test driving QML (20)

Test driving-qml
Test driving-qmlTest driving-qml
Test driving-qml
 
Test driving-qml
Test driving-qmlTest driving-qml
Test driving-qml
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
 
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
 
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and BeyondWebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
WebTest - Efficient Functional Web Testing with HtmlUnit and Beyond
 
Arakoon: A distributed consistent key-value store
Arakoon: A distributed consistent key-value storeArakoon: A distributed consistent key-value store
Arakoon: A distributed consistent key-value store
 
Drupalcamp Simpletest
Drupalcamp SimpletestDrupalcamp Simpletest
Drupalcamp Simpletest
 
Testing In Drupal
Testing In DrupalTesting In Drupal
Testing In Drupal
 
Google test training
Google test trainingGoogle test training
Google test training
 
Testing in go
Testing in goTesting in go
Testing in go
 
Creating testing tools to support development
Creating testing tools to support developmentCreating testing tools to support development
Creating testing tools to support development
 
Testing
TestingTesting
Testing
 
Combined Project
Combined ProjectCombined Project
Combined Project
 
Gallio Crafting A Toolchain
Gallio Crafting A ToolchainGallio Crafting A Toolchain
Gallio Crafting A Toolchain
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
Automating the Quality
Automating the QualityAutomating the Quality
Automating the Quality
 
Functional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with FrankensteinFunctional Testing Swing Applications with Frankenstein
Functional Testing Swing Applications with Frankenstein
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
 
Xp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And MocksXp Day 080506 Unit Tests And Mocks
Xp Day 080506 Unit Tests And Mocks
 

Recently uploaded

call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
vikas rana
 

Recently uploaded (15)

(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
 
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
9892124323, Call Girls in mumbai, Vashi Call Girls , Kurla Call girls
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
 
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
 
WOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxWOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptx
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
 

Test driving QML

  • 1. Test-Driving QML Artem Marchenko March 15, 2011
  • 2. 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 http://fi.linkedin.com/in/artemmarchenko
  • 3. 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 Q&As
  • 5. Example of a QML-code developed via TDD
  • 6. 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/ qmakeqtest-qml.pro make make install make docs make check Project page: http://qt.gitorious.net/qt-labs/qtest-qml
  • 7. Getting started 2(3) Create the simplest test in your project
  • 8. Getting started 3(2) And a script that runs the test: runTests.sh in this case #!/bin/bash clear /Users/artem/QtSDK/Desktop/Qt/471/gcc/bin/QMLViewer.app/Contents/MacOS/QMLViewer tst_tddCalculator2.qml
  • 10. UI level: simulating mouse click
  • 11. UI level: simulating touch and drag
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. Thank you Q&As time You can find these slides at http://agilesoftwaredevelopment.com/tags/tdd

Editor's Notes

  1. Adding numbers continuously – property bindingChange color when result is over 1000 => .toString() when comparing complex built-in objectsMove to states. Change the default color
  2. Increase font on mouseClick – when:windowShown