Meego Wiki
Views

Quality/QA-tools/TDriver

From MeeGo wiki
Jump to: navigation, search

Contents

Testability Driver (TDriver)

New to TDriver? Look for an introduction to TDriver from Forum Nokia web site.

TDriver is a test automation driver enabling acceptance testing through the UI or using business logic directly. It is written in Ruby language and enables using any test framework written for Ruby.

For a sample test run, see TDriver in action. The cucumber tests in the example can be found from here.

Overview

TDriver consists of the following modules:

Agent

TDriver has one agent for Qt based systems where Qt applications on any supported OS can be tested. The Qt agent is called qttasserver.

Agent (qttas-server) is the only component that needs to be installed to the SUT (system under test). It will handle communication with the testing framework and applications. When Qt application starts it will load a testability plugin into the application process. The plugin will register the application into qttasserver. Once the application is registered to qttasserver, it can be controlled and queried from the testing framework.

MeeGo touch applications will automatically load the testability plugin. If your application is a standard Qt application, use the "-testability" argument:

myapp -testability

That will cause the testability plugin to be loaded automatically.

Driver

Driver is the component that will provide the glue between test harness and SUT. You can install driver inside SUT or you can also use another host for driver that will connect to sut over tcp/ip.

TDriver is a ruby class libary which is packaged as a Ruby gem. Package 'rubygem-testability-driver' provides the core functionality and 'rubygem-testability-driver-qt-sut-plugin' provides the qt specific support.

Visualizer

Visualizer is a helper tool that provides access to UI components of the application. It will help testers to know what objects are contained and what is possible to do with them. You will see a SUT screenshot and an object tree containing all visible object. For Qt applications the objects are fetched from the object tree of the application registered to qttasserver. Visualizer also contains documentation and a small editor to help in scripting and debugging.

Installation

On a typical test automation setup, tests are executed on the host. See the Getting Started Guide for host based installation. If you are going to install TDriver on MeeGo netbook, see the Installation on MeeGo Netbook section.

Adding Agent On The Target Device

On host based testing, the only required package for the image is the qttas-server. Add this package to your ks. file if you want it into your image.

On a preexisting image, you can add it by

sudo zypper install qttas-server

This will install the agent. Once you reboot the agent should start automatically.

If you do not reboot the device, you can start the agent manually by:

qttasserver &

Note - qttasserver should always be run with the same user as the applications, e.g. meego

Adding Everything On The Image

You can also run the entire testability driver on the device. Currently packages are only in devel:quality. Add the devel:quality repository into the ks. file:

repo --name=devel-quality-testing  --baseurl=http://download.meego.com/live/devel:/quality/testing/ 

And add the meta package:

testability-driver

Package rubygem-cucumber is also available if you have Cucumber tests.

Installation on MeeGo Netbook

You need to enable devel:quality repo as not all components in Trunk:Testing

sudo zypper ar http://download.meego.com/live/devel:/quality/testing/ devel:quality.repo
sudo zypper update

To install all required packages install the testability-driver and visualizer packages. But lets install the tests package so we can easily test the installation:

sudo zypper install testability-driver-tests testability-driver-visualizer 

You can test the installation using irb:

 [matti@matti-desktop tmp]$ irb
irb(main):001:0> require 'tdriver'
=> true
irb(main):002:0> 


To test the visualizer, make sure qttasserver is running and start testapp:

 qttasserver &
 testapp &

Now make sure you have RUBYOPT set and start visualizer:

 export RUBYOPT=rubygems
 tdriver_visualizer &

Now you should see the visualizer application. Select sut_qt from device menu and select File -> Refresh. You should now see screenshot of testapp and object tree which contains all visible objects from the application.

You can also try to run our unit tests to see that automated tests work:

ruby /usr/share/testability-driver-tests/tc_testapp.rb

And the script will use the app 'testapp' to test basic things like launching and closing app, tapping, dragging, flick etc.

Enabling Logs On The Agent

In order to debug you can enable logs on the device. Just create a folder and give appropriate write access so that qttasserver and applications can write in there:

mkdir -p /logs/testability
sudo chmod a+w /logs/testability

Now if you restart qttasserver you will see a log file qttasserver.log being created. For each application loading testability plugin there will be also a file <application_name>.log

Personal tools