[SailfishDevel] (Unit) tests for QML apps

Marcin Mielniczuk marmistrzmar at gmail.com
Fri Jul 28 13:25:19 UTC 2017


+1, I've never figured it out either. I asked a similar question a long time ago but never received an answer.

On July 27, 2017 1:08:26 AM GMT+02:00, Trolli Schmittlauch <t.schmittlauch+ml at orlives.de> wrote:
>Hi,
>
>I'm currently working on a QML only app for Sailfish and want to write
>some unit tests for it. For that I'm using QtTest quick component.
>Are there some other devs doing UnitTests on their QML apps? Are you
>using QtTest, too?
>
>One important question there is how to structure the project wit its
>tests? I'm currently using a project structure recommended by Artem
>Marchenko [1] which is the best I could find. It puts the tests into an
>own subpackage so they're not distributed in the release builds. But
>this approach still has its problems: You have to change import paths
>for autocompletion in QtCreator to work, but have to change them back
>again for a build to succeed. Furthermore, this approach ist still
>quite complex.
>So which project structure and approach for running tests are you
>using?
>
>The 3rd point is just pro-forma as I expect there is no comfortable
>solution for that problem: One feature I'm developing needs a database
>migration. I want to test this migration by providing a pre-migration
>test db, executing the db and checking the result. But
>QtQuick.LocalStorage doesn't allow opening files but only databases
>with a certain name stored in some offlineStoragePath. This could be
>theoretically changed in the C++ part via QtQMLEngine, but thats hardly
>doable if you run your tests using the QUICK_TEST_MAIN() macro.
>So any ideas regarding how to best test a db migration?
>
>Best regards
>
>schmittlauch
>
>[1] https://github.com/amarchen/helloworld-pro-sailfish

-- 
Sent from my mobile. Please excuse my brevity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20170728/53383f33/attachment.html>


More information about the Devel mailing list