Meego Wiki
Views

Quality/QA-tools/TDriver/Getting Started

From MeeGo wiki
< Quality | QA-tools | TDriver
Revision as of 15:11, 24 November 2010 by Tatlahte (Talk | contribs)
Jump to: navigation, search

Contents

Testability Driver (TDriver) Getting Started Guide

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

Installing required packages from repositories

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.

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

Ubuntu 10.04

Note - you cannot use the Ubuntu 10.04 repository in 10.10. The version is compiled agains Qt 4.6, which is not compatible

TDriver requires Rubygems and xml libraries:

sudo apt-get install rubygems ruby1.8-dev libxslt-dev libxml2-dev 

We are ready to install TDriver packages, so skip to Installing TDriver.


Fedora 13

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 here).

Compiling ruby (skip this step if you downloaded the packages)

sudo yum install rpmdevtools # 
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

Install the ruby packges that were created:

cd ~
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

Next we need rubygems:

rpmbuild --rebuild rubygems-*src.rpm
sudo yum localinstall --nogpgcheck rpmbuild/*/*/rubygems-1.3.7*.noarch.rpm


Install other requirements, required to build native dependencies for ruby gems:

sudo yum install libxslt-devel libxml2-devel

We are ready to install TDriver packages, so skip to Installing TDriver.


You will need to compile the Qt components. Skip to compilation .


Compiling TDriver from git

TDriver components can be installed on most Qt and Ruby supported platforms. On other Linux distributions, search for the equivalent packages that are described in Ubuntu 10.10 and Fedora 14 build requirements.

Ubuntu 10.10

Install build requirements:

sudo apt-get install libxtst-dev libqtwebkit-dev qt4-qmake g++ libqt4-dev 

Requirements for Ruby components:

sudo apt-get install rubygems ruby1.8-dev libxslt-dev libxml2-dev 

Fedora 14

Build requirements:

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

Build requirements for Ruby components:

sudo yum install libxslt-devel libxml2-devel


Compilation

Compile and install qttas-server:

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.
cd agent_qt 
qmake -r CONFIG+=no_mobility 
make
sudo make install

Visualizer:

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

Installing TDriver

Install the Testabiity Driver qt plugin. This will install everything required.

sudo gem install testability-driver-qt-sut-plugin # This will take a few minutes

Try that it works

export RUBYOPT="rubygems" # This should go to your login file e.g. .bashrc
ruby -e "require 'tdriver'" 

The command above prints out nothing, the ruby components are installed successfully.


Ubuntu 10.04

To install visualizer:

sudo apt-get install visualizer qttas-server 

Fedora 13

sudo yum install --nogpgcheck testability-driver-visualizer qttas-server

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:

sudo yum install git qt4-qmake gcc-c++
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

qttas-server &
calculator &

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 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!

Running Automated Tests

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

sudo gem install cucumber

Run a test:

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

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

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

What's Next

TODO

  • Contacting to MeeGo device
  • Tutorial for test creation
  • Making your application load the testability plug-in
  • Making your application testable


Links

Personal tools