Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qml Testcase element #147

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Qml Testcase element #147

wants to merge 6 commits into from

Conversation

henrikrudstrom
Copy link
Member

Added a qml TestCase element that works in both qmlweb and qt. It defines a test function, handles startup delay and timeout, has basic test functions (expect.toBe and fail for now) and a compareRender function.

When a test containing a TestCase element as the child of the root is run in jasmine:

  1. a new spec is created
  2. the test functions are mapped to the corresponding functions in jasmine
  3. test function is run

qmlweb-dev now has an utility qtqmltest which can load a qml file and run the testcases defined in it. The compareRender function creates a reference screenshot instead of comparing it.

To test it:
from the qmlweb directory:

git clone https://github.com/qmlweb/qmlweb-dev.git dev
cd dev 
./build.sh

then run: node dev/render.js

@ChALkeR
Copy link
Member

ChALkeR commented Apr 16, 2016

Sorry for the delay, will take a look at this now.

@ChALkeR
Copy link
Member

ChALkeR commented Apr 16, 2016

Hm. Perhaps we need a proper way to declare elements in qml first (with parsing them at the build-time).
TestCase element looks like something we would want to have in the library itself, not just in the tests folder.

@ChALkeR
Copy link
Member

ChALkeR commented Apr 16, 2016

This pull request is a little to big and covers different topics, not only the TestCase element. It would be a lot easier to review if this was split to independant changes.

@henrikrudstrom
Copy link
Member Author

henrikrudstrom commented Apr 21, 2016

@ChALkeR
I agree, would be good to have a way to declare qml objects as part of the source. But we should make sure we can properly debug the code if we precompile the qml elements, or add the option to run them uncompiled for testing/debugging purposes.
Perhaps we could start by allowing qml files in the source folder?

as for the commits, i know its a big one, but im not sure i have time to squash them again in the near future, but here is a description:

82bac2d: adds some file to gitignore (related to the screenshot generator)

aa70e8f: render.js, basically the existing render code moved to a separate file and defines some global functions to be available in the qmltest:
window.compareScreenshot, window.renderTest, window.it

83ac1be: replace the existing render code with the refactored render code.

208172c: adds the TestCase.qml element, and a convenience subclass RenderTest.qml and some stylenits. Adds the option to specify additional import paths to the prefixedQmlLoader (not sure that is actually used in this PR),

71b7088: adds the qml testcases, and an example testsuite, tests.js.

07a1bf7: adds support for a before() function in a testcase to change properties before the qml element is rendered. and some minor tweaks.

@Plaristote
Copy link
Member

Plaristote commented Jun 25, 2016

This has stalled long enough ! Unless someone else objects, I'll take care of splitting that PR in the next days.

EDIT: Looks like this is so old that the merge process is fucking up. I cannot for the life of me find what happened to some of the files that weren't created, but edited by this PR... this isn't going to be a breeze.

@ChALkeR
Copy link
Member

ChALkeR commented Jan 11, 2017

Related: #389.

@ChALkeR
Copy link
Member

ChALkeR commented Jan 13, 2017

I don't think we should make render tests more complex.
Instead, we should make a small testcase that could be used with Qt to check that all those tests pass on Qt, like qmltestrunner -input tests/Auto/ for Auto tests.

@ChALkeR
Copy link
Member

ChALkeR commented Jan 15, 2017

Instead, we should make a small testcase that could be used with Qt to check that all those tests pass on Qt, like qmltestrunner -input tests/Auto/ for Auto tests.

That's done in cb3283c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants