22
votes

Are there any tools for performing code coverage analysis on QML code? Is such a question even applicable to a declarative language like QML?

2
Its really interesting question. First what came to my head is "Tools -> QML/JS -> Run Checks" in QtCreator. - tro
It's really interesting, indeed. The coverage should involve any js function as well as bindings, property assignments, and so on. I guess it's not so easy to do on QML, for some features are directly accessible by instrumenting the QML files, while some others require to instrument the C++ code (as an example - unless you don't care about if and when a dynamic binding happens, but you are interested on the code executed by that function). The same happens if you have classes written in C++ and exported to the QML environment, of course. - skypjack
This or perhaps in future this? - Steve Chambers
The first one doesn't cover the C++ code, anyway. Am I wrong? - skypjack
Hm. Since QML is declarative with som js on top, and since declarative probably won't need any coverage test, maybe a tool that separates out js and does coverage on that would do? - Lennart Rolland

2 Answers

3
votes

There was a talk recently on QtCon about C++ and QML code coverage. https://conf.qtcon.org/en/qtcon/public/events/407 (Open the page and click on video link to watch)

The talk was by Harri Porten who is co-founder and co-CEO of froglogic GmbH, a company which sells automated GUI testing tools. They also have a blog post about QML code coverage http://blog.froglogic.com/2014/10/measuring-qml-coverage/

0
votes

Classic coverage treatment of JavaScript and C++ does not have to be the end of QML coverage analysis.

For example, coverage of States is thinkable as well. Are all of them entered during test execution? That's what users of Coco filed as feature requests at least.