aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/src/appdevguide/qtquicktest.qdoc
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2012-05-28 17:12:56 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-21 09:58:56 +0200
commit5e33b0f580d2b20f1a2989bf2ee8dde4525a2e39 (patch)
tree780d25ce7d8955e56ea985a35dd84609df12fbf0 /src/quick/doc/src/appdevguide/qtquicktest.qdoc
parent03342a435a88656d64d1445991a4421d244fcb45 (diff)
Create new documentation structure
The documentation currently has no clear separation between Qt QML and Qt Quick. With recent commits like: 6c8378eaf1edbbefe6aaa3672b0127816a004fd7 and ab1e510121c8a679fdaca12ccd30e0f7ac12a26b the separation between the language definition and implementation, provided by Qt QML, and the standard library for the QML language, provided by Qt Quick, is clear. This commit creates a new documentation structure that is more navigable and separates concepts into logical categories, with clear separation between QtQML and QtQuick. It also provides a more generic QML Application Developer Resources page which contains links to information for QML application developers. Change-Id: Ia807ccfbfd24ffa0e1c7f0a51ed9d2ed3aa6a733 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/doc/src/appdevguide/qtquicktest.qdoc')
-rw-r--r--src/quick/doc/src/appdevguide/qtquicktest.qdoc108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/quick/doc/src/appdevguide/qtquicktest.qdoc b/src/quick/doc/src/appdevguide/qtquicktest.qdoc
new file mode 100644
index 0000000000..50ce424464
--- /dev/null
+++ b/src/quick/doc/src/appdevguide/qtquicktest.qdoc
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms
+** and conditions contained in a signed written agreement between you
+** and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtquick-qtquicktest.html
+\inqmlmodule QtQuick 2
+ \title QtQuickTest Reference Documentation
+ \keyword QtQuickTest Reference Documentation
+ \brief unit testing framework for QML
+
+ \section1 Introduction
+
+ QtQuickTest is a unit test framework for QML applications.
+ Test cases are written as JavaScript functions within a TestCase
+ element:
+
+ \code
+ import QtQuick 2.0
+ import QtTest 1.0
+
+ TestCase {
+ name: "MathTests"
+
+ function test_math() {
+ compare(2 + 2, 4, "2 + 2 = 4")
+ }
+
+ function test_fail() {
+ compare(2 + 2, 5, "2 + 2 = 5")
+ }
+ }
+ \endcode
+
+ Functions whose names start with \c{test_} are treated as test cases
+ to be executed. See the documentation for the \l TestCase and
+ \l SignalSpy elements for more information on writing test cases.
+
+ \section1 Running tests
+
+ Test cases are launched by a C++ harness that consists of
+ the following code:
+
+ \code
+ #include <QtQuickTest/quicktest.h>
+ QUICK_TEST_MAIN(example)
+ \endcode
+
+ Where "example" is an identifier to use to uniquely identify
+ this set of tests. You should add \c{CONFIG += qmltestcase}.
+ for example:
+
+ \code
+ TEMPLATE = app
+ TARGET = tst_example
+ CONFIG += warn_on qmltestcase
+ SOURCES += tst_example.cpp
+ \endcode
+
+ The test harness scans the specified source directory recursively
+ for "tst_*.qml" files. If \c{QUICK_TEST_SOURCE_DIR} is not defined,
+ then the current directory will be scanned when the harness is run.
+ Other *.qml files may appear for auxillary QML components that are
+ used by the test.
+
+ The \c{-input} command-line option can be set at runtime to run
+ test cases from a different directory. This may be needed to run
+ tests on a target device where the compiled-in directory name refers
+ to a host. For example:
+
+ \code
+ tst_example -input /mnt/SDCard/qmltests
+ \endcode
+
+ See \c{tests/qmlauto} in the source tree for an example of creating a
+ test harness that uses the \c{QUICK_TEST_SOURCE_DIR} macro.
+
+ If your test case needs QML imports, then you can add them as
+ \c{-import} options to the the test program command-line by adding
+ the following line to your .pro file:
+
+ \code
+ IMPORTPATH += $$PWD/../imports/my_module1 $$PWD/../imports/my_module2
+ \endcode
+*/