testing of embedded and mobile qt and qml applications · 2018. 11. 19. · mobile qt and qml...

25
Testing of embedded and mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten

Upload: others

Post on 29-Oct-2020

38 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Testing of embedded and mobile Qt and QML

Applications

Qt Developer Days 2013

by Harri Porten

Page 2: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Goal

Page 3: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

About me

Name: Harri Porten Company: froglogic GmbH Position: co-founder and CTO Qt usage: since 1997 (KDE project) Qt development: Software Engineer at Trolltech

Page 4: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Overview

Types of Testing Why Automate? Challenges on embedded and mobile platforms Live demo

Page 5: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Types of Testing

Unit Testing Performance Testing ... Functional GUI Testing

- Black/Gray Box Testing- Assume user's point of view- Automate to spot regressions- Combine with profiling, coverage and other analysis and monitoring tools

Page 6: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Why Automate?

Faster- Get results quicker- Run more tests in the same time

Trivial to replay in different configurations Reliable, reproducible and repeatable Relieve testers from monotonous tasks

Page 7: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

But...

Automating GUI tests is not trivial Typical reason for test effort failures: wrong test approach

Page 8: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Platform Challenge

Qt runs on:

Windows (various versions) Linux (desktop and embedded) Mac OS X Android Boot to Qt iOS QNX VxWorks Nucleus ….

Page 9: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Toolkit Challenge

Those may play a role:

QWidgets QML elements Native controls Web!

Most challenging: combinations of the above.

Page 10: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Platform Solution 1/2

Biggest help from....

Qt itself

Page 11: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Platform Solution 2/2

Additional help through:

Resolution independence Synchronization methods UI abstractions Reusable functions/objects Mock objects

Page 12: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Virtualization

Target hardware- the real thing- limited number- harder to automate

Virtual systems- VMware, Virtual Box, qemu- emulator vs. simulator- easy replication, resets and automation- Simulation of hardware features, limitations and events.

Page 13: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Capture and replay

Produces massive test scripts Not readable Not maintainable No code re-use possible Brittle against changes in the UI

Solution: Scripting & Refactoring

Page 14: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Script Languages

Beware of “vendor scripts” or “macros”!

Open and powerful choices exist: JavaScript Python Perl Ruby Tcl ...

Page 15: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Factorization

function main() { launchApplication(“clean”); loadData(“sample.dat”); changeParameter(“ParameterA”, 10); runCalculation(); dumpData(“out.txt”); compareData(“out.txt”, “expected.txt”);}

Page 16: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

GUI Objects

login = LoginScreen() login.tryLogin(“myuser”, “wrongpassword”) test.compare(login.success, False) test.compare(login.message, “Wrong password”) login.tryLogin(“myuser”, “realpassword”) test.compare(login.success, True)

Page 17: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Scripted Approach vs. Capture & Replay

Page 18: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Screen coordinates

Addresses screen positions and not UI controls Breaks with UI layout changes Depends on GUI style and platform Scripts hard to understand

Solution: Address objects based on properties

Page 19: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Reliance on screen captures

No knowledge of GUI controls Too much heuristics Depends on irrelevant data (colors, fonts, etc.) Many incorrect fails / errors

Solution: Identify on and compare object properties

Page 20: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

UI Styles

Tab Control

Page 21: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

UI Styles

File Selectors

And mobile and embedded..???

Page 22: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Example: Widget Recognition Options

Very BAD:

MouseClick(132, 367)

BAD:

MouseClick('Tree', 30, 136)

BAD:

MouseClick(

FindObjByImg('item-image.png'))

GOOD:

ClickItem('Tree', 'Event')

Page 23: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Help from Developers

QObject::setObjectName() QML “id” property

Page 24: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Architecture

Location vs. Remote

Page 25: Testing of embedded and mobile Qt and QML Applications · 2018. 11. 19. · mobile Qt and QML Applications Qt Developer Days 2013 by Harri Porten. Goal. About me ... Performance Testing

Demo

Live