behavior driven development and testing of qt and qml · pdf file ·...
TRANSCRIPT
![Page 1: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/1.jpg)
Behavior Driven Development and Testingof Qt and QML applications
Qt Developer Days 2014
by Reginald Stadlbauer
![Page 2: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/2.jpg)
About me
Name: Reginald Stadlbauer Company: froglogic GmbH Position: co-founder and CEO Worked as Software Engineer at Trolltech and the KDE project
![Page 3: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/3.jpg)
About froglogic
HQ: Hamburg Founded: 2003 US presence since 2008 Product focus on Squish
- Squish GUI Tester (Cross-Platform/Cross-Technology GUI Test Automation)- Squish Coco (C, C++ and C# Code Coverage)
More than 3.000 customers world-wide
![Page 4: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/4.jpg)
Overview
What is BDD and TDD Automating a Behavior Driven Test Live Demo & Conclusion
![Page 5: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/5.jpg)
What is BDD / BDT?
“BDD is a second-generation, outside-in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.” - Dan North
http://en.wikipedia.org/wiki/Behavior-driven_development
OR...
![Page 6: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/6.jpg)
What is BDD / BDT?
Based on Test Driven Development- Write (failing) test- Implement feature until test passes- Unit-Test level granularity (inside-out)
But- Focus on application's behavior and specification- Description in a human-readable DSL (e.g. Gherkin)- Less focus on implementation details
![Page 7: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/7.jpg)
Versatile usage of Feature Files
User story / feature specification Communicate with customer / users Documentation of acceptance test Sequence to walk through for manual tests Storyboard for automation of tests
![Page 8: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/8.jpg)
Why BDD/BDT
“Test first” development on a higher level Clearly separate test logic from implementation Allow non-programmers to define features & tests Have a common, single language two communicate
![Page 9: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/9.jpg)
What is BDD / BDT – Unit Conversion
![Page 10: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/10.jpg)
What is BDD / BDT – Unit Conversion
Feature: Valid conversion
Scenario: Convert meter in centimeter
Given the Unit Converter is running
When I enter 378.9
And choose to convert from "m"
And choose to convert to "cm"
And click Convert
Then 37890 should be displayed in the result field
Feature File (Gherkin)
![Page 11: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/11.jpg)
What is BDD / BDT – Unit Conversion
Feature: Invalid conversion
Scenario: Mix units
Given the Unit Converter is running
When I enter 378.9
And choose to convert from "m"
And choose to convert to "kg"
And click Convert
Then ERROR should be displayed in the result field
And "Unit type mismatch: Length vs. Weight." should be displayed in red
Feature File (Gherkin)
![Page 12: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/12.jpg)
What is BDD / BDT – The Process
Write a failingFeature Test
MakeFeature Test
pass
Implement/Refactor
Code
Test
Manually Automated
![Page 13: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/13.jpg)
Automating a Behavior Driven Test
Requirements- BDT framework- testing framework (unit, GUI, ...)- Glue between both
![Page 14: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/14.jpg)
BDT Framework – Generate Skeletons
Parse feature files Generate step definition skeletons (functions and annotations) in preferred language
Test.feature
Feature: Valid conversion
Scenario: Convert meter in centimeter
Given the Unit Converter is running
When I enter 378.9
....
Test.py
@Step("Given the Unit Converter is running")
def step(context):
test.warning("Implement me”)
@Step("When I enter 378.9")
def step(context):
test.warning("Implement me”)
![Page 15: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/15.jpg)
BDT Framework – Run Feature Files
Parse feature files Execute feature files by mapping to steps to step definitions (functions) Reporting
Test.feature
Feature: Valid conversion
Scenario: Convert meter in centimeter
Given the Unit Converter is running
When I enter 378.9
....
Test.py
@Step("Given the Unit Converter is running")
def step(context):
[...]
@Step("When I enter 378.9")
def step(context):
[...]
![Page 16: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/16.jpg)
Testing framework
Support the specific programming language Support the specific UI technology of AUT Scripting support / integration options Tooling for convenient test creation, maintenance and debugging
Test.py
@Step("Given the Unit Converter is running")
def step(context):
startApplication("UnitConverter”)
@Step("When I enter 378.9")
def step(context):
click("FromField”)
typeText("378.9”)
![Page 17: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/17.jpg)
Integrating BDT and test frameworks
Need to “talk the same language” Reporting Debugging
![Page 18: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/18.jpg)
BDT Frameworks
Cucumber
JBehave
Behave
SpecFlow
RSpec
Lettuce
Squish GUI Tester
...
![Page 19: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/19.jpg)
Unit Testing Frameworks
QtTestLib
Qt Quick Test
CppUnit
GoogleTest
xUnit
NUnit
JUnit
...
![Page 20: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/20.jpg)
GUI Testing Frameworks
Squish GUI Tester
HP QTP
Rational Functional Tester
Selenium
...
![Page 21: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/21.jpg)
Live Demos
QML Unit Converter- Non-GUI test (backend)- GUI test (frontend)
![Page 22: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/22.jpg)
Q & A
Questions? Visit our booth or email [email protected]
Free and supported trial of Squish at http://www.froglogic.com/evaluate
![Page 23: Behavior Driven Development and Testing of Qt and QML · PDF file · 2015-03-17Behavior Driven Development and Testing of Qt and QML applications Qt Developer Days 2014 by Reginald](https://reader030.vdocuments.us/reader030/viewer/2022013107/5aa733537f8b9ac5648bcd46/html5/thumbnails/23.jpg)
About Squish GUI Tester
Cross-Platform / Cross-GUI-Technology Test Automation- Windows, Linux, Mac OS X, Unix, RTOSes, Mobile- Java (Swing/AWT, SWT/RCP, JavaFx), Qt/QML/QtQuick, Web, MFC, WinForms, WPF, iOS,
Cocoa, Carbon, Android, Tk, Flex, …
Object-based GUI object identification Record & replay Powerful scripting (JavaScript, Python, Ruby, Tcl, Perl) Eclipse-based IDE Built-in BDD framework and support
Batch-testing via command-line tools Remote/distributed testing architecture Integrations: Microsoft ALM, HP QC/ALM, Rational RQM, Seapine TCM, SpiraTest, MKS,
XStudio, Jenkins, Hudson, TeamCity, Bamboo, Robot Framework, JUnit, Maven, …