Meego Wiki
Views

Quality/QA-tools/TDriver/Getting Started

From MeeGo wiki
< Quality | QA-tools | TDriver(Difference between revisions)
Jump to: navigation, search
m
(Removing redundant information ("driver" and "sut_qt" are installed following steps of "Other platforms" section))
 
(36 intermediate revisions not shown)
Line 1: Line 1:
-
= Testability Driver (TDriver) Getting Started Guide =
+
= Testability Driver Getting Started Guide =
-
This page describes the installation of the Testability Driver on your host machine. We provide repositories for Fedora 13 and Ubuntu 10.04, and more will be added as soon as it's possible from OBS. For other platforms and versions you will need to compile the Qt components from source.
+
This page describes the installation of the Testability Driver (TDriver) on your host machine.
== Installing required packages from repositories ==
== Installing required packages from repositories ==
-
First wee need to enable the Testing:Tools repository. See the [http://wiki.meego.com/Quality/QA-tools/How_to_set_up_repositories How to set up repositories for QA-tools] guide.
+
We provide repositories for Fedora 13 and Ubuntu 10.04/10.10, and more will be added as soon as it's possible from OBS. For other platforms and versions you will need to compile the Qt components from source.  
-
=== Ubuntu 10.04 ===
+
First wee need to enable the Testing:Tools repository. See the [[Quality/QA-tools/How_to_set_up_repositories|How to set up repositories for QA-tools]] guide.
-
'''Note - you cannot use the Ubuntu 10.04 repository in 10.10. The version is compiled agains Qt 4.6, which is not compatible'''
+
For Ubuntu:
-
 
+
-
TDriver requires Rubygems and xml libraries:
+
<pre>
<pre>
-
sudo apt-get install rubygems ruby1.8-dev libxslt-dev libxml2-dev visualizer
+
sudo apt-get install qttas testability-driver-host visualizer # This can take several minutes
</pre>
</pre>
-
Skip to [[#Installing TDriver]].
+
Fedora:
-
 
+
-
=== Ubuntu 10.10 ===
+
-
 
+
-
 
+
-
To install build requirements
+
<pre>
<pre>
-
sudo apt-get install libxtst-dev libqtwebkit-dev qt4-qmake g++ libqt4-dev
+
yum install qttas testability-driver-host testability-driver-visualizer
</pre>
</pre>
-
Requirements for Ruby components:
+
Start a new shell and you should have all the required environmental parameters set.
-
<pre>
+
-
sudo apt-get install rubygems ruby1.8-dev libxslt-dev libxml2-dev
+
-
</pre>
+
-
You will need to compile the Qt components. Skip to  [[#Compilation|compilation]] .
 
 +
== Other platforms ==
-
=== Fedora 13 ===
+
TDriver components can be installed on most Qt and Ruby supported platforms. The ruby components can be found from rubygems.org. You will need the following packages, or their equivalents installed:
-
 
+
-
Unfortunately Fedora 13 does not have the required Ruby 1.8.7, so we need to compile and install it first. (If you do not want to compile it yourself, you can download the packages from [https://github.com/leamas/diaspora/downloads here]).  
+
-
 
+
-
Compiling ruby (skip this step if you downloaded the packages)
+
-
 
+
<pre>
<pre>
-
sudo yum install rpmdevtools #
+
rubygems ruby1.8-dev libxslt-dev libxml2-dev
-
rpmdev-setuptree
+
-
sudo yum install yum-utils fedora-release-rawhide gcc
+
-
yumdownloader --enablerepo=rawhide --source ruby rubygems
+
-
sudo yum install $( rpm -qRp ruby-*src.rpm | grep -v rpmlib) gcc-g++
+
-
rpmbuild --rebuild ruby-*src.rpm # Compilation will take a few minutes
+
</pre>
</pre>
-
Install the ruby packges that were created:
+
Then install the gems:
<pre>
<pre>
-
cd ~
+
sudo gem install testability-driver testability-driver-qt-sut-plugin
-
sudo yum localinstall --nogpgcheck  \
+
-
                    rpmbuild/*/*/ruby-1.8.7.*.rpm        \
+
-
                    rpmbuild/*/*/ruby-libs-1.8.7.302*.rpm    \
+
-
                    rpmbuild/*/*/ruby-devel-1.8.7.302*.rpm  \
+
-
                    rpmbuild/*/*/ruby-irb-1.8.7.302*.noarch.rpm \
+
-
                    rpmbuild/*/*/ruby-rdoc-1.8.7.302*.noarch.rpm
+
</pre>
</pre>
-
Next we need rubygems:
+
=== Building Qt components ===
 +
Build requirements for ubuntu 10.04:
<pre>
<pre>
-
rpmbuild --rebuild rubygems-*src.rpm
+
sudo apt-get install libqt4-dev x11proto-xext-dev libxtst-dev
-
sudo yum localinstall --nogpgcheck rpmbuild/*/*/rubygems-1.3.7*.noarch.rpm
+
</pre>
</pre>
-
 
+
Build requirements for Ubuntu 10.10:
-
Install other requirements, required to build native dependencies for ruby gems:
+
<pre>
<pre>
-
sudo yum install libxslt-devel libxml2-devel
+
sudo apt-get install libqt4-dev x11proto-xext-dev libxtst-dev libqtwebkit-dev
</pre>
</pre>
-
Skip to [[#Installing TDriver]].
+
Build requirements for Fedora:
-
 
+
-
=== Fedora 14 ===
+
-
 
+
-
Build requirements:
+
<pre>
<pre>
sudo yum install libxtst-devel libqtwebkit-devel qt4-qmake gcc-c++ libqt4-devel
sudo yum install libxtst-devel libqtwebkit-devel qt4-qmake gcc-c++ libqt4-devel
</pre>
</pre>
-
Build requirements for Ruby components:
+
Getting Qt source-code:
<pre>
<pre>
-
sudo yum install libxslt-devel libxml2-devel
+
git clone git://gitorious.org/qt/qt.git
</pre>
</pre>
-
You will need to compile the Qt components. Skip to [[#Compilation|compilation]] .
+
Then the installation procedure depends on our platform. Full detail is available at the following link <nowiki>http://doc.qt.nokia.com/<Qt_version>/installation.html</nowiki>, in which we replace <Qt_version> by our git cloned Qt version (i.e. 4.7).
-
 
+
-
 
+
-
== Compling TDriver from source repositories ==
+
-
 
+
=== Compilation ===  
=== Compilation ===  
-
 
+
Compile and install qttas-server:
-
Compile and install qttas-server
+
<pre>
<pre>
-
git clone http://gitorious.org/tdriver/agent_qt.git # Note that this our development master. See the list of available tags if you want to checkout a released version.
+
git clone http://git.gitorious.org/tdriver/agent_qt.git # Note that this is our development master. See the list of available tags if you want to checkout a released version.
cd agent_qt  
cd agent_qt  
qmake -r CONFIG+=no_mobility  
qmake -r CONFIG+=no_mobility  
Line 106: Line 70:
</pre>
</pre>
-
Compile and install visualizer
+
Visualizer:
<pre>
<pre>
-
git clone http://gitorious.org/tdriver/visualizer.git
+
git clone http://git.gitorious.org/tdriver/visualizer.git
cd visualizer
cd visualizer
qmake -r  
qmake -r  
Line 115: Line 79:
</pre>
</pre>
-
== Installing TDriver ==
 
-
Install the Testabiity Driver qt plugin. This will install everything required.
+
== Testing the installation ==
 +
 
 +
Everything should now be installed. We need an application to test it with, so let's get one. Let's use a classic calculator application that is used in TDriver tests.
 +
 
 +
Let's get it from git and compile it.
 +
Build requirements for Ubuntu:
<pre>
<pre>
-
sudo gem install testability-driver-qt-sut-plugin # This will take a few minutes
+
sudo apt-get install git-core qt4-qmake qt4-dev-tools build-essential
</pre>
</pre>
-
Try that it works
+
Fedora:
<pre>
<pre>
-
export RUBYOPT="rubygems" # This should go to your login file e.g. .bashrc
+
sudo yum install git qt4-qmake gcc-c++
-
ruby -e "require 'tdriver'"
+
</pre>
</pre>
-
The command above prints out nothing, the ruby components are installed successfully.
+
Compile and install:
 +
<pre>
 +
git clone http://git.gitorious.org/tdriver/tests.git
 +
cd tests/calculator
 +
qmake # in Fedora qmake command is qmake-qt4
 +
make
 +
sudo make install
 +
</pre>
 +
Now we are ready to start the qttas-server and the calculator:
 +
<pre>
 +
qttasserver &
 +
calculator -testability &
 +
</pre>
-
=== Ubuntu 10.04 ===
+
You should see a simple calculator application. Next, let's start the visualizer:
-
To install visualizer:
+
<pre>
<pre>
-
sudo apt-get install visualizer qttas-server
+
tdriver_visualizer & # If you compiled visualizer from source, it will be under /opt/tdriver_visualizer
</pre>
</pre>
-
=== Fedora 13 ===
+
In the visualizer, select File->Refresh. You should see a picture of the calculator application. If you hover your mouse above the picture, the visualizer will highlight the object that is currently under the cursor.
-
sudo yum install --nogpgcheck testability-driver-visualizer qttas-server
+
-
== Testing the installation ==
+
[[File:Visualizer.png|800px|Visualizer window (click to enlarge)]]
-
Everything should be now installed.
+
Right click on an element, for example "1" button, and select "send tap to SUT". The calculator should receive a click to the "1" button. If so, congratulations you have a working TDriver environment!
-
We need an application to test it with, so download one. Let's a classic calculator application.
 
-
Compilation:
+
== Running Automated Tests ==
 +
 
 +
We are ready to run an automated test. We will need [[http://cukes.info Cucumber]], so let's install it:
<pre>
<pre>
-
sudo yum install git qt4-qmake gcc-c++
+
sudo gem install cucumber # This will take a few minutes and require gherkin-2.3.2
-
git clone http://git.gitorious.org/tdriver/tests.git
+
-
cd tests/calculator
+
-
qmake # in Fedora qmake-qt4
+
-
make
+
</pre>
</pre>
-
Now we are ready to start the qttas-server and the calculator
+
We still need to edit the tdriver parameters. Add the following line to <tt>/etc/tdriver/tdriver_parameters.xml</tt> inside
 +
<tt><parameters></tt> tag:
<pre>
<pre>
-
qttas-server &
+
<parameter name="default_sut" value="sut_qt"/>
-
./calculator &
+
</pre>
</pre>
-
You should see a simple calculator application. Next, let's start the visualizer.
+
We can use the tests repository we got the calculator from as an example. From there, we will run one test:
 +
<pre>
 +
# cd <wherever you cloned the tdriver/tests repository>
 +
cd test/
 +
cucumber features/qt_widget_tap.feature:8 # Run one scenario from one feature
 +
</pre>
 +
Something like this should be displayed on the console:
<pre>
<pre>
-
tdriver_visualizer & # If you compiled visualizer from source, it will be under /opt/tdriver_visualizer
+
~/tests/test$ cucumber features/qt_widget_tap.feature:8
 +
@qt_linux @qt_windows @qt_symbian @qt_meego
 +
Feature: MobyBehaviour::QT::Widget#tap
 +
  As a test script writer
 +
  I want to use tap method to simulate user tapping or clicking an object,
 +
  so that I can test the MobyBehaviour::QT::Widget behaviour
 +
 
 +
  Scenario: Tap a QWidget button                          # features/qt_widget_tap.feature:8
 +
    Given I launch application "calculator"                # features/step_definitions/feature_common.rb:65
 +
    When I execute "@app.Button(:name => 'oneButton').tap" # features/step_definitions/feature_common.rb:165
 +
    Then The calculator display says "1"                  # features/step_definitions/feature_common.rb:235
 +
 
 +
1 scenario (1 passed)
 +
3 steps (3 passed)
 +
0m1.598s
 +
~/tests/test$
</pre>
</pre>
-
In the visualizer, select File->Refresh. You should see a picture of the calculator application. If you hover your mouse above the picture, the visualizer will highlight the object that is currently under the cursor.
+
Everything should be up and running now. You are ready for test development!
-
[[File:Visualizer.png|800px|Visualizer window (click to enlarge)]]
+
=== Testing Your Application ===
-
Right click on an element, for example one button, and select "send tap to SUT". The calculator should receive a click to the "1" button. If so, congratulations you have a working TDriver environment!
+
If your application is a Meegotouch application, the qttas plugin will be loaded automatically. If it is a standard Qt application, pass "-testability" as a command line parameter.
-
== What's next ==
+
=== Connecting to your MeeGo device ===  
-
TODO
+
Note: If you used the "testability-driver-host" package to install TDriver, the ip address is set automatically to the "sut_qt_maemo" device.
-
* Contacting to MeeGo device
+
-
* Tutorial for test creation
+
-
* Running cucumber tests
+
-
* Making your application load the testability plugin
+
-
* Making your application testable
+
 +
You need a working network connection to the device. For the N900, see the [[ARM/N900/Tips and Tricks/N900 USB Networking|N900 Networkig Guide]]. TDriver works over TCP/IP, so any device in the network can be tested.
 +
As an example, connection to the N900 we add the N900 ip address into /etc/tdriver/tdriver_parameters.xml:
 +
<pre>
 +
<sut id="sut_qt" template="qt">
 +
<parameter name="qttas_server_ip" value="192.168.2.15" />
 +
<!-- other parameters.... -->
 +
</sut>
 +
</pre>
 +
 +
On the device, make sure the package "qttas-server" is installed and "qttasserver" is running as user. If you just installed the package, you will need to restart the applications to make them load the qttas plugin. On the N900, the qttasserver should start automatically and all supported applications should be available.
 +
 +
If you refresh the visualizer, you should see the application content that is running on the N900. Note - If you edit the configuration file, the visualizer must be restarted.
 +
 +
 +
== What's Next ==
 +
 +
=== TODO ===
 +
 +
* Making your application load the testability plug-in
 +
* Making your application testable
=== Links ===  
=== Links ===  
 +
* [http://doc.qt.nokia.com/ Qt Online Reference Documentation]
* [https://projects.forum.nokia.com/Testabilitydriver/wiki/ TDriver wiki]
* [https://projects.forum.nokia.com/Testabilitydriver/wiki/ TDriver wiki]
* [https://projects.forum.nokia.com/dav/Testabilitydriver/doc/api/qt_linux/ API Documentation]
* [https://projects.forum.nokia.com/dav/Testabilitydriver/doc/api/qt_linux/ API Documentation]
* [http://gitorious.org/tdriver/ Gitorious project]
* [http://gitorious.org/tdriver/ Gitorious project]
 +
* [http://wiki.meego.com/Quality/QA-tools/TDriver/Getting_Started/Tutorial_for_test_creation Tutorial for test creation]

Latest revision as of 12:16, 9 May 2011

Contents

Testability Driver Getting Started Guide

This page describes the installation of the Testability Driver (TDriver) on your host machine.


Installing required packages from repositories

We provide repositories for Fedora 13 and Ubuntu 10.04/10.10, and more will be added as soon as it's possible from OBS. For other platforms and versions you will need to compile the Qt components from source.

First wee need to enable the Testing:Tools repository. See the How to set up repositories for QA-tools guide.

For Ubuntu:

sudo apt-get install qttas testability-driver-host visualizer # This can take several minutes

Fedora:

yum install qttas testability-driver-host testability-driver-visualizer

Start a new shell and you should have all the required environmental parameters set.


Other platforms

TDriver components can be installed on most Qt and Ruby supported platforms. The ruby components can be found from rubygems.org. You will need the following packages, or their equivalents installed:

rubygems ruby1.8-dev libxslt-dev libxml2-dev 

Then install the gems:

sudo gem install testability-driver testability-driver-qt-sut-plugin

Building Qt components

Build requirements for ubuntu 10.04:

sudo apt-get install libqt4-dev x11proto-xext-dev libxtst-dev 

Build requirements for Ubuntu 10.10:

sudo apt-get install libqt4-dev x11proto-xext-dev libxtst-dev libqtwebkit-dev 

Build requirements for Fedora:

sudo yum install libxtst-devel libqtwebkit-devel qt4-qmake gcc-c++ libqt4-devel

Getting Qt source-code:

git clone git://gitorious.org/qt/qt.git

Then the installation procedure depends on our platform. Full detail is available at the following link http://doc.qt.nokia.com/<Qt_version>/installation.html, in which we replace <Qt_version> by our git cloned Qt version (i.e. 4.7).

Compilation

Compile and install qttas-server:

git clone http://git.gitorious.org/tdriver/agent_qt.git # Note that this is our development master. See the list of available tags if you want to checkout a released version.
cd agent_qt 
qmake -r CONFIG+=no_mobility 
make
sudo make install

Visualizer:

git clone http://git.gitorious.org/tdriver/visualizer.git
cd visualizer
qmake -r 
make 
sudo make install


Testing the installation

Everything should now be installed. We need an application to test it with, so let's get one. Let's use a classic calculator application that is used in TDriver tests.

Let's get it from git and compile it. Build requirements for Ubuntu:

sudo apt-get install git-core qt4-qmake qt4-dev-tools build-essential

Fedora:

sudo yum install git qt4-qmake gcc-c++

Compile and install:

git clone http://git.gitorious.org/tdriver/tests.git
cd tests/calculator
qmake # in Fedora qmake command is qmake-qt4
make
sudo make install

Now we are ready to start the qttas-server and the calculator:

qttasserver &
calculator -testability &

You should see a simple calculator application. Next, let's start the visualizer:

tdriver_visualizer & # If you compiled visualizer from source, it will be under /opt/tdriver_visualizer

In the visualizer, select File->Refresh. You should see a picture of the calculator application. If you hover your mouse above the picture, the visualizer will highlight the object that is currently under the cursor.

Visualizer window (click to enlarge)

Right click on an element, for example "1" button, and select "send tap to SUT". The calculator should receive a click to the "1" button. If so, congratulations you have a working TDriver environment!


Running Automated Tests

We are ready to run an automated test. We will need [Cucumber], so let's install it:

sudo gem install cucumber # This will take a few minutes and require gherkin-2.3.2

We still need to edit the tdriver parameters. Add the following line to /etc/tdriver/tdriver_parameters.xml inside <parameters> tag:

<parameter name="default_sut" value="sut_qt"/>

We can use the tests repository we got the calculator from as an example. From there, we will run one test:

# cd <wherever you cloned the tdriver/tests repository>
cd test/
cucumber features/qt_widget_tap.feature:8 # Run one scenario from one feature

Something like this should be displayed on the console:

~/tests/test$ cucumber features/qt_widget_tap.feature:8
@qt_linux @qt_windows @qt_symbian @qt_meego
Feature: MobyBehaviour::QT::Widget#tap
  As a test script writer
  I want to use tap method to simulate user tapping or clicking an object,
  so that I can test the MobyBehaviour::QT::Widget behaviour

  Scenario: Tap a QWidget button                           # features/qt_widget_tap.feature:8
    Given I launch application "calculator"                # features/step_definitions/feature_common.rb:65
    When I execute "@app.Button(:name => 'oneButton').tap" # features/step_definitions/feature_common.rb:165
    Then The calculator display says "1"                   # features/step_definitions/feature_common.rb:235

1 scenario (1 passed)
3 steps (3 passed)
0m1.598s
~/tests/test$ 

Everything should be up and running now. You are ready for test development!

Testing Your Application

If your application is a Meegotouch application, the qttas plugin will be loaded automatically. If it is a standard Qt application, pass "-testability" as a command line parameter.

Connecting to your MeeGo device

Note: If you used the "testability-driver-host" package to install TDriver, the ip address is set automatically to the "sut_qt_maemo" device.

You need a working network connection to the device. For the N900, see the N900 Networkig Guide. TDriver works over TCP/IP, so any device in the network can be tested.

As an example, connection to the N900 we add the N900 ip address into /etc/tdriver/tdriver_parameters.xml:

<sut id="sut_qt" template="qt">
<parameter name="qttas_server_ip" value="192.168.2.15" />
<!-- other parameters.... -->
</sut>

On the device, make sure the package "qttas-server" is installed and "qttasserver" is running as user. If you just installed the package, you will need to restart the applications to make them load the qttas plugin. On the N900, the qttasserver should start automatically and all supported applications should be available.

If you refresh the visualizer, you should see the application content that is running on the N900. Note - If you edit the configuration file, the visualizer must be restarted.


What's Next

TODO

  • Making your application load the testability plug-in
  • Making your application testable

Links

Personal tools