aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-09-06 12:43:16 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-09-13 14:40:52 +0000
commit215c0145be7119a0e885ff95a17ee7aebd17ad12 (patch)
treeb35ca53e4d3792ccb28a80a97ff75a1d41cbc4c8 /src/imports
parent7236b0dfdb9ae805f4ba595def2b696859aa3613 (diff)
qmltest: Enumerate test cases / functions without evaluating QML
Most, if not all, QML tests are written without any sort of dynamic instantiation of the test data, so doing view.setSource() will evaluate the whole source file, compute bindings, create items, windows, etc. This is less then ideal when all you want is to list the test functions using -functions, or when running a single test from the command line, as in both cases we'll still actually evaluate every single QML file. This makes it really hard to evaluate test output, e.g. from the CI, especially with logging enabled, as even if a single test is requested, the logs are filled with results from the loading of the other tests. To improve the situation we use a non-instantiated QML component that we then inspect its compilation data, looking for test cases and functions. In the future the implementation of TestCase's qtest_run* machinery should be built on top of QTestLib instead of being reimplemented in JavaScript, but this is left for later. Change-Id: Ie5448208daf786e335583ab6bdfbc195891ec1f5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/testlib/TestCase.qml25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 18af7e0ab0..0e7e09c65c 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -1739,11 +1739,6 @@ Item {
/*! \internal */
function qtest_run() {
- if (util.printAvailableFunctions) {
- completed = true
- return
- }
-
if (TestLogger.log_start_test()) {
qtest_results.reset()
qtest_results.testCaseName = name
@@ -1894,29 +1889,9 @@ Item {
}
}
-
Component.onCompleted: {
QTestRootObject.hasTestCase = true;
qtest_componentCompleted = true;
-
- if (util.printAvailableFunctions) {
- var testList = []
- for (var prop in testCase) {
- if (prop.indexOf("test_") != 0 && prop.indexOf("benchmark_") != 0)
- continue
- var tail = prop.lastIndexOf("_data");
- if (tail != -1 && tail == (prop.length - 5))
- continue
- // Note: cannot run functions in TestCase elements
- // that lack a name.
- if (name.length > 0)
- testList.push(name + "::" + prop + "()")
- }
- testList.sort()
- for (var index in testList)
- console.log(testList[index])
- return
- }
qtest_testId = TestLogger.log_register_test(name)
if (optional)
TestLogger.log_optional_test(qtest_testId)