1
For qmluitests and unittests tests.
7
Tests under qmluitests target should be designed in a way that they can be run either
8
automatically (with qmltestrunner) or manually (with qmlscene). So make sure you
9
add UI controls for manual interaction and labels for monitoring output when needed.
11
The order in which tests are run should not matter. The test application
12
should be in its initial state before each and every test function is called.
13
Therefore it should be reset when a test function finishes or before the next
14
one starts. A convenient way of doing so is using the init() function of the
15
TestCase component. It gets called automatically before each test function.
17
The name property of [Unity]TestCase does not include a 'Test' suffix.
18
Both [Unity]TestCase and their functions are placed after properties
19
and Components being tested.
29
property var exampleProperty
31
function test_something() {}
39
When you write a test function, try to explain what it's trying to check, what's
40
the use case. Because in most cases the name of the test function is not expressive
43
// Checks that the filter toggle button, the one that says "View All (xy)",
44
// shows up only when it's possible for the grid to be expanded.
45
function test_filterToggleButton()
48
Hints and tips on test API usage
49
================================
51
The compare() function can take a third, optional, argument. It is the error
52
message that will be displayed when the test fails. Thus, if you use it, you
53
should talk about the failure case, not about the expected/successful one.
56
compare(newAppScreenshot.withBackground, false,
57
"switched app have background disabled")
59
compare(newAppScreenshot.withBackground, false,
60
"switched app have background enabled")
62
compare(newAppScreenshot.withBackground, false,
63
"screenshot of app being brought to foreground has unnecesary background")