Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QtopiaSystemTest namespace provides script based system test functionality for Qt Extended. More...
#include <QtopiaSystemTest>
This namespace is under development and is subject to change.
The QtopiaSystemTest namespace provides script based system test functionality for Qt Extended.
This documentation describes the API reference for the QtUiTest scripting language. Please read the QtUiTest Manual for a full description of the system test tool.
All system tests which make use of the QtopiaSystemTest namespace also have access to the QSystemTest namespace.
This enum specifies which type of memory to measure when using the memory related performance functions.
Constant | Value | Description |
---|---|---|
QtopiaSystemTest::NoMemoryType | 0x00 | Refers to no memory at all. |
QtopiaSystemTest::TotalMemory | 0x01 | The total physical memory available to the test system. |
QtopiaSystemTest::FreeMemory | 0x02 | The free memory available to the test system. Note that most operating systems, including Linux, will intentionally consume almost all free memory in buffers and caches, to improve filesystem performance. Therefore, the value returned by FreeMemory will usually be very low. A better measure of the effectively free memory can be obtained by using EffectiveFreeMemory. |
QtopiaSystemTest::EffectiveFreeMemory | FreeMemory | CacheMemory | BuffersMemory | The memory which is either free, or used by the kernel in such a way that it can probably be easily freed if an application requests more memory. |
QtopiaSystemTest::BuffersMemory | 0x04 | Memory currently consumed in kernel buffers. The kernel is usually able to easily free most of this memory if an application requests more memory. |
QtopiaSystemTest::CacheMemory | 0x08 | Memory currently consumed in filesystem caches. The kernel is usually able to easily free most of this memory if an application requests more memory. |
QtopiaSystemTest::ActiveMemory | 0x10 | Memory currently considered active by the kernel. "Active" memory typically refers to memory that would take some effort for the kernel to free. |
QtopiaSystemTest::InactiveMemory | 0x20 | Memory currently considered inactive by the kernel. "Inactive" memory typically refers to memory that is backed by disk or able to be discarded easily by the kernel. |
The MemoryTypes type is a typedef for QFlags<MemoryType>. It stores an OR combination of MemoryType values.
This enum specifies which data to retrieve from the recorded memory usage information when using the getSampledMemoryInfo() function.
Constant | Value | Description |
---|---|---|
QtopiaSystemTest::NoSampledMemoryInfoFlags | 0x00000000 | No flags. |
QtopiaSystemTest::SampleMinimum | 0x00000001 | Return the minimum sampled value. |
QtopiaSystemTest::SampleMaximum | 0x00000002 | Return the maximum sampled value. |
QtopiaSystemTest::SampleMean | 0x00000004 | Return the mean of all sampled values. Note that this flag cannot be used with SampleFile or SampleLine. |
QtopiaSystemTest::SampleFile | 0x00010000 | Return the file containing the test script which was running at the time this sample was taken. |
QtopiaSystemTest::SampleLine | 0x00020000 | Return the line number of the test script at the time this sample was taken. |
The SampledMemoryInfoFlags type is a typedef for QFlags<SampledMemoryInfoFlag>. It stores an OR combination of SampledMemoryInfoFlag values.
This enum specifies which version is returned by getVersion().
Constant | Value | Description |
---|---|---|
QtopiaSystemTest::QtVersion | 0x00 | The version of Qt used on the test system. |
QtopiaSystemTest::QtExtendedVersion | 0x01 | The version of Qt Extended used on the test system. |
QtopiaSystemTest::KernelVersion | 0x02 | The version of the Linux kernel used on the test system. |
Background all currently running applications and return to the Home screen.
See also Application Management.
Returns an alias that will be resolved by Qt Extended to activate the callAccept function, either by simulating a Call-Accept keyclick or by selecting a Call Accept somehow on a touchscreen. Example:
select(callAccept()); // presses the CallAccept button
The test will fail if no Call Accept can be simulated.
See also optionsMenu(), softMenu(), and callHangup().
Returns an alias that will be resolved by Qt Extended to activate the callHangup function, either by simulating a Call-Hangup keyclick or by selecting a Call Hangup somehow on a touchscreen. Example:
select(callHangup()); // presses the CallHangup button
The test will fail if no Call Hangup can be simulated.
See also optionsMenu(), softMenu(), and callAccept().
Returns the path of the documents directory on the test system.
Example:
// Put a test image into the image directory in documents on the test system.
putFile( baseDataPath() + "tiger.jpg", documentsPath() + "image/tiger.jpg");
See also QSystemTest::getFile(), QSystemTest::putFile(), QSystemTest::getData(), QSystemTest::putData(), and File Management.
Measure and return the current memory usage, in kilobytes, on the test system for memory of the given type.
If type is a flag containing multiple types, the memory usage of the desired types will be added together.
Example:
// Get the amount of effectively free memory on the system.
function freeMemory() {
return getMemoryInfo(FreeMemory|BuffersMemory|CacheMemory);
}
It is not necessary to call startSamplingMemory() before using this function.
See also startSamplingMemory(), stopSamplingMemory(), and getSampledMemoryInfo().
Get information about sampled memory for the specified memory types, using the given flags to decide what data to return.
Use startSamplingMemory(), stopSamplingMemory() and this function to measure the effective memory usage of particular use cases of Qt Extended.
For example:
spin_the_yoyo: function() { var total_memory = getMemoryInfo(TotalMemory); // Ensure we start measuring from the home screen gotoHome(); startSamplingMemory(500); // Spin the yoyo startApplication("yoyo-manager"); select("Spin"); waitForTitle("Spin complete"); // Measure the memory used to spin the yoyo stopSamplingMemory(); var min_free = getSampledMemoryInfo(EffectiveFreeMemory, SampleMinimum); var min_free_line = getSampledMemoryInfo(EffectiveFreeMemory, SampleMinimum|SampleLine); print("Max used memory: " + (total_memory - min_free) + " Kb, at line " + min_free_line); }
Returns the version number specified by type.
Example:
print( "Qt Extended Version: " + getVersion(QtExtendedVersion) ); print( "Qt Version: " + getVersion(QtVersion) ); print( "Linux Version: " + getVersion(KernelVersion) );
Close all currently running applications and return to the Home screen.
See also Application Management.
Send an IPC message on a Qt Extended IPC channel. The optional arguments arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 and arg9 are arguments to the IPC message.
Example:
// Put a new document on the system and force a document rescan
putFile("testdata/mydoc.txt", "$HOME/Documents/mydoc.txt");
ipcSend("QPE/DocAPI", "scanPath(QString,int)", "all", 1);
Returns an alias that will be resolved by Qt Extended to find the Launcher Menu. Example:
select( "Contacts", launcherMenu() );
See also softMenu(), callAccept(), and callHangup().
Returns an alias that will be resolved by Qt Extended to find the Options Menu. Example:
select( "New", optionsMenu() ); // select the item with text 'New' from the options menu print( signature(optionsMenu()) ); // to print the name of the resolved widget.
Note that 'signature(optionsMenu())' incurs an extra roundtrip and should only be used in exceptional cases.
The test will fail if no options menu can be activated, or if multiple option menus are found.
See also softMenu(), callAccept(), and callHangup().
Reboot the device running Qt Extended.
This method instructs QPE to reboot the device in the same way as the "Reboot" option in the shutdown dialog. Whether or not this method succeeds depends on how QPE was launched and the permissions of the user account under which it is running.
Example:
// Start performance testing, and reboot Qt Extended to get the cold startup time of Qt Extended setSetting("$HOME/Settings/Trolltech/StartupFlags.conf", "PerfTest", "State", 1);
reboot();
See also restartQtopia() and Application Management.
Restart Qtopia.
This method instructs QPE to restart in the same way as the "Restart" option in the shutdown dialog. This is actually implemented by simply closing QPE and relying on the script which started it to restart it. Hence whether or not this method succeeds depends on how QPE was launched.
Example:
// Restore Greenphone to factory defaults for the next test setSetting("$HOME/Settings/Trolltech/StartupFlags.conf", "RestoreDefaults", "State", 1); restartQtopia(); // Put back the setting so we don't restore to factory defaults after next restart setSetting("$HOME/Settings/Trolltech/StartupFlags.conf", "RestoreDefaults", "State", 0);
See also reboot() and Application Management.
Returns true if the test is running on an actual device, and false if it is running in a virtual framebuffer (on the desktop machine).
Shut down Qtopia.
Returns an alias that will be resolved by Qt Extended to find the Soft Menu. Example:
select( "Help", softMenu() ); // select the item with text 'Help' from the soft menu print( signature(softMenu()) ); // to print the name of the resolved widget.
Note that 'signature(softMenu())' incurs an extra roundtrip and should only be used in exceptional cases.
The test will fail if no visible soft menu is found, or if multiple soft menus are found.
See also callAccept() and callHangup().
Start the specified application.
application can be the name of a binary to execute on the test system (e.g. 'addressbook') or the full name of an application as shown in the launcher grid (e.g. 'Contacts'). The application must connect to the test framework within timeout ms or the test fails.
flags specifies additional behaviour.
The application will be launched by sending a Qt Extended IPC message. To simulate launching an application by key clicks, use select( <appname>, launcherMenu() ).
Example:
// Start several apps and keep them in the background startApplication("Notes", 1000, BackgroundCurrentApplication); startApplication("Contacts", 1000, BackgroundCurrentApplication); startApplication("todolist", 1000, BackgroundCurrentApplication); // Now start btsettings without Background, which means all current apps // will be exited. startApplication("btsettings");
See also Application Management.
Start sampling memory at fixed intervals.
Every interval milliseconds, the current memory usage will be sampled and stored. Once sampling has finished, the data can be retrieved using getSampledMemoryInfo().
Each memory sample causes network traffic between the system test and Qt Extended. Therefore, using an extremely small interval will have a negative impact on performance.
See also stopSamplingMemory(), getMemoryInfo(), and getSampledMemoryInfo().
Stop sampling memory.
See also startSamplingMemory(), getMemoryInfo(), and getSampledMemoryInfo().
Get the QtopiaSystemTestModem currently used as the modem device.
If Qt Extended is not currently connected to a QtopiaSystemTestModem, Qt Extended will be restarted and forced to connect to a new QtopiaSystemTestModem, which will be returned.
The returned QtopiaSystemTestModem may be explicitly deleted if desired. Otherwise, it will be destroyed when the system test completes. In either case, when the QtopiaSystemTestModem is destroyed, Qt Extended will be restarted and will no longer connect to the simulated modem.
Example:
// Change operator name from within a system test
QVERIFY( testModem() );
testModem()->setVariable("OP", "Qt Extended Comms");
testModem()->send("+CREG: 5");
See also restartQtopia() and Telephony Simulation.
Returns true if the specified application gains focus within timeout milliseconds.
Waits up to timeout milliseconds for Qt Extended to become fully initialized. On the desktop, the first call to this function will start Qt Extended using the runqtopia script.
Once initialized:
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |