[Development] qtest-qml osx
Chao Caroline
Caroline.Chao at digia.com
Mon Jan 6 13:40:50 CET 2014
Hi,
The TestCase doc should refer to QtQuickTest and not QtTest indeed, please log a documentation bug for it.
Also I have attached a small example to get you started, with a source component to test under src/qml and the test file under specs/qml. It should work with both qmltestrunner or a QUICK_TEST_MAIN.
You don't need IMPORTPATH here. It is used when you want to load a module (only qml files or a cpp plugin), which is defined by a qmldir file (in the attached example it can be for example src/qml/qmldir containing
"module qml
MyRectangle 1.0 MyRectangle.qml")
Regards,
Caroline
________________________________________
From: Joshua Kolden [joshua at crackcreative.com]
Sent: Monday, January 06, 2014 12:40 AM
To: Alan Alpert
Cc: Chao Caroline; development at qt-project.org
Subject: Re: [Development] qtest-qml osx
On Dec 16, 2013, at 10:44 AM, Alan Alpert <416365416c at gmail.com> wrote:
> On Mon, Dec 16, 2013 at 3:47 AM, Chao Caroline <Caroline.Chao at digia.com> wrote:
>
Thanks I didn’t realize any of this since the TestCase docs[0] don’t refer to the “Qt Quick Test Reference” docs[1]. Which I would suggest is probably a documentation bug?
I’ve been able to get the simplest case of this working (despite the docs being very abstract), but I think I’m seeing a bug when used in my project. Can someone please confirm it isn't user error before I log the bug?
In my environment I have source and tests separated into `src/qml`, and `specs/qml` respectively.
Regardless if I use the qmltestrunner or a QUICK_TEST_MAIN macro I’m unable to include components from the src/qml path, so unless the tst_*.qml file is actually present in that path no components are loaded. This is true whether I invoke the item with a bare reference, or with `Qt.createComponent()`.
I’ve tried using the -import command line option as documented, with all variations on absolute and relative paths to the `src/qml` path. I’ve also tried `IMPORTPATH`, `INCLUDEPATH`, and `QUICK_TEST_SOURCE_DIR` in the test .pro file.
Production qml files are simply not accessible by tests unless I contaminate the src folder with all the tst_*.qml files (which is a non-starter on this large of a project).
Thanks,
j
[0] - http://qt-project.org/doc/qt-5/qml-qttest-testcase.html
[1] - http://qt-project.org/doc/qt-5/qtquick-qtquicktest.html
On Dec 16, 2013, at 10:44 AM, Alan Alpert <416365416c at gmail.com> wrote:
> On Mon, Dec 16, 2013 at 3:47 AM, Chao Caroline <Caroline.Chao at digia.com> wrote:
>> Hi,
>>
>> Qt Quick Test is part of Qt (in the qtdeclarative repo). I think the problem
>> here is that you are trying to run a test using qmlscene directly.
>>
>> QML TestCases should be launched via a C++ harness:
>> http://qt-project.org/doc/qt-5/qtquick-qtquicktest.html
>>
>
> The other alternative is the qmltestrunner utility.
>
> qmlscene is not expected to work, nor planned to, but ideally support
> will be added to the new qml utility (such support is not currently in
> place but wouldn't be too hard to add).
>
> --
> Alan Alpert
>
>>
>>
>> ________________________________
>> From: development-bounces+caroline.chao=digia.com at qt-project.org
>> [development-bounces+caroline.chao=digia.com at qt-project.org] on behalf of
>> Joshua Kolden [joshua at studiopyxis.com]
>> Sent: Sunday, December 15, 2013 11:18 PM
>> To: development at qt-project.org
>> Subject: [Development] qtest-qml osx
>>
>> We have a fairly large qml project, and with 5.2 we are trying to switch to
>> TDD for all components (c++, js (coffescript), QML). Qt Creator and
>> qmlscene in 5.2 both seem to have the same issue that files are missing:
>>
>>> qmlscene test1.qml
>> file:///x/d/qt/testDrivenQML/test1.qml:25 Type TestCase unavailable
>> file:///Users/joshua/Qt5.2.0/5.2.0/clang_64/qml/QtTest/TestCase.qml:45
>> module "Qt.test.qtestroot" is not installed
>>
>>
>> qt-labs/qtest-qml has a merge request under ‘review’ from 2 years ago!! It
>> refers to a problem with OSX installation (OSX is our primary development
>> environment). I have not been able to test this issue on other platforms,
>> but noticing that both the merge request and the README install directions
>> for qtest-qml are both very dated I thought it might be better just to ask
>> here if this is dead, or is it supposed to work in 5.2 / OSX? Docs for
>> TestCase in 5.2 imply that it’ll work the same as any QML Type.
>>
>> Also in a separate note, the new Qt Creator crashes consistently when trying
>> to create a new qt quick project through the interface.
>>
>> Thanks for the hard work!
>>
>> Best,
>> j
>>
>>
>> _______________________________________________
>> Development mailing list
>> Development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_qmltest.tar.gz
Type: application/x-gzip
Size: 1657 bytes
Desc: example_qmltest.tar.gz
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140106/02404a10/attachment.bin>
More information about the Development
mailing list