This is xnee.info, produced by makeinfo version 4.0 from xnee.texi.

INFO-DIR-SECTION Miscellaneous
START-INFO-DIR-ENTRY
* Xnee: (xnee).		X events recorder and player
END-INFO-DIR-ENTRY

   This file documents Xnee This file is written by Henrik Sandklef
2002-10-xx Copyright 2002 Henrik Sandklef


File: xnee.info,  Node: Top,  Up: (dir)

Xnee Manual
***********

   This file documents the Xnee

Introduction
************

Short description
=================

   Xnee can record and replay an X session. Xnee also has the ability to
distribute events to multiple displays.

Xnee features
=============

   Test tool Instead of performing test cases for a GUI (or CLI
program) cases over and over again, the test cases can be automated.
Simply record a user session and replay it later.

   Performance test tool 	If you want to simulate lots of
simultaneous users in a network (or 	a local machine) you can use Xnee.
Simply record a (or many) users 	sessions and start multiple instances
of Xnee.

   Demo tool 	You can use Xnee to demonstrate the features of
your program. Simply 	record a user session and replay it later.

   Distribution tool 	If you want to send over your mouse/keyboard
actions to another display 	you can use the built-in
distribution mechanism in Xnee.

Background
==========

   In order to verify that a program does the job it's supposed to do,
certain tests have to be made. These tests are, IMHO, perhaps the most
boring things a programmer can do. With xnee the testcase(s) can be
recorded and later on replayed. Xnee can also distribute events (both
when recording and replaying) to other displays.

   Initially, Xnee was made to release the programmer (that's me) from
the burdon of testing, who hopefully will be writing free software
instead (I am doing that), from this burdon.

How does it work
================

   Xnee uses X Windows System. For more information about this lovely
system, go to :
   * X.org                   <http://www.x.org>

   * XFree86 		<http://www.xfree86.org>

   * Ken Lee's X site	<http://www.rahul.net/kenton/xsites.html>

   Xnee receives X11 protocol data (e g XEvents) from an X server and
prints them to a file (or stdout). Mouse and kwyboard actions generate
device events.  These events can be relpayed. Other X11 data can also
recorded. These data is used when replaying to synchronise. This is not
only useful but essential.  We can not replay or regenerate
keyboard-events to a window before it's ready to "receive" events. By
recording data other than device events

Xnee usage
**********

Getting started with Xnee
=========================

   To get the first feel of Xnee four examples are presented.

Simple replay
-------------

   Start one terminal emulator (e.g xterm) Start Xnee,
        `xnee -rep -f example1.xnr &'
   ....dont forget '&'.  The file example1.xnr contains keyboard events
recorded during development of this manual.  When replayed you'll what
was typed and of course more important yu'll get i first glimpse of
Xnee and its capabilities.

Simple recording
----------------

   We move on to a (very) simple recording session Start a terminal
emulator (e.g xterm) and your favorite editor.  Move the pointer to one
of the terminal windows and start Xnee.
        `xnee -o exmaple2.xnr --device_event_range 2-3 --time 5 --loops 20'
   Move the pointer to the pther terminal windows and get focus (e.g
click the window frame) After 5 seconds you can type whatever you want
to record (20 press/relase of the keyboard are recorded).  We are done,
you have recorded your first session!  Leave the desktop as it is and
go for the next example.

Simple replaying of you recorded file
-------------------------------------

   Let Xnee repeat the stuff you did in example 2.  Undo all changes in
the editor that was made in the previous example.  Move the pointer to
one of the terminal windows and start Xnee.
        `xnee -rep -f exmaple2.xnr --time 5'
   Move the pointer to the pther terminal windows and get focus (e.g
click the window frame) After 5 seconds you will see your typings in
the example above being repeated.

Recorded session files
----------------------

   The example file above (example1.xnr) is a session file that has
been delivered with the sources (allthough not installed), rpm and with
the Xnee Documentation Package. The file(s) can be found:
                       Distribution           Location
                       RPM                    /usr/lib/xnee/sessions
                       Source                 ./sessions/
                       Document Package       ./sessions/

Modes
=====

   Xnee has three modes:
   * record  (default mode)

   * replay

   * distribute
   The distributiion mechanism can be used together with the other two.

Record
------

   When record mode is used Xnee receives a copy of the data sent to
and from the X server. The copy is printed to either stdout or a file.
Xnee can record more data than only mouse and keyboard events.

Replay
------

   When replay mode is used Xnee reads data from a file or stdin. These
data is either sent to the server (if it is a keyboard or a mouse
event) or used to synchronise with (if any of the other data).

Distribution
------------

   Xnee can distribute mouse and keyboard events to multiple displays.
The distribution mechanism can be used when recording as well as when
replaying.

Ranges
======

   What data to record is specified using ranges. Ranges has a start
value and a stop value. The following data can be recorded:

        Xnee name                        X Protocol Name
        core_requests                    Request
        device_event                     Event
        delivered_event                  Event
        error                            Error
        reply                            Reply
        ext_requests.ext_major           Extension Request
        ext_requests.ext_minor           Extension Request
        ext_replies.ext_major            Extension Reply
        ext_replies.ext_minor            Extension Reply
   For an explanation on the X protocol data, please read the "X Record
Extension Library" or the "Record Extension Protocol Specification".

First and last motion event
===========================

   Xnee has the ability to skip recording of succesive motion events
with no other data in between. This option is intended to reduce the
number of data recorded by leaving out unnecessary data. This feature
can be invoked with the -first_last flag.

Delay
=====

   Sometimes when Xnee starts recording data, the keyrelease (due to
pressing and releasing RETURN to execute the Xnee command line) is
recorded. This single keyrelease (with no corresponding keypress) might
confuse the X server. With the -time <secs> option Xnee can be paused
for secs seconds.

Verbose
=======

   When enabling verbose mode (-verbose) Xnee prints a lot of
information about it's state. This option is only intended for
debugging.

Human printouts
===============

   Sometimes it's hard to decide what data to use when synchronising.
To do this you simply have to see what data is printed out when
recording. Instead of reading the data number, s tring representation
of the data is printed out. To enable this option, use the
"-human_printouts"

Plugin file
===========

   Xnee's behaviour can be set using a prepared file containing the
settings to be used.

Plugin file syntax
------------------

`display displayname'
     	This sets the display to record or send events to when replaying

`file <file_name>'
     	Use the file <file_name> when replaying

`out <file_name>'
     	Redirect printouts to <file_name> (stdout is default)

`err <file_name>'
     	Redirect error printouts to <file_name> (stderr is default)

`plugin <file_name>'
     	Use plugin named <plugin_name>

`first_last'
     	Sets the first_last option to true

`everything'
     	Tells Xnee to record everything.

`loops <n>'
     	How many data to record. -1 means for ever.

`k_log'
     	Record 1000 data.

`10k_log'
     	Record 100 000 data.

`100k_log'
     	Record 100 000 data.

`m_log'
     	Record 1000 000 data.

`verbose'
     	Turns on verbose mode

`time <secs>'
     	Pauses Xnee for secs seconds

`stop_key modifier key'
     	Recording/replaying stops when pressing modifier + key.
     See chapter "Stop key syntax" and "Stop modifier syntax" for syntax

`future_clients'
     	TO BE DOCUMNETED

`all_clients'
     	TO BE DOCUMNETED

`human_printouts'
     	Print recorded data in a human friendlier format

`record'
     	Use record mode

`replay'
     	Use replay mode

`distribute <LIST>'
     	Sets the list of displays to distribute events to

`device_event_range     <X_LIST>'
     	Sets the list of device events to record to <X_LIST>

`delivered_event_range  <X_LIST>'
     	Sets the list of delivered events to record to <X_LIST>

`error_range            <X_LIST>'
     	Sets the list of errors to record to <X_LIST>

`request_range          <X_LIST>'
     	Sets the list of requests to record to <X_LIST>

`reply_range            <X_LIST>'
     	Sets the list of replies to record to <X_LIST>

`extension_request_major_range  <X_LIST>'
     	Sets the list of extension request major to record to <X_LIST>

`extension_request_minor_range <X_LIST>'
     	Sets the list of extension request minor to record to <X_LIST>

`extension_reply_major_range    <X_LIST>'
     	Sets the list of extension reply major to record to <X_LIST>

`extension_reply_mainor_range   <X_LIST>'
     	Sets the list of extension reply minor to record to <X_LIST>

   LIST is a comma separated list if displays, e.g
192.168.1.2:9,10.0.0.2:1

   X_LIST is a comma separated list of ranges, e.g 12-15,17,22-29

Stop key syntax
---------------

   You can set the key by entering one character or the keycode for the
character you wish to use

Stop modifier syntax
--------------------

   You can set the modifier to any of the following
`Shift or Shift'
     Modifier is set to the Shift key

`LockMask or Lock'
     Modifier is set to the Lock key

`Control or ctrl'
     Modifier is set to the Control key

`Mod1Mask or m1m'
     Modifier is set to

`Mod2Mask or m2m'
     Modifier is set to

`Mod3Mask or m3m'
     Modifier is set to

`Mod4Mask or m4m'
     Modifier is set to

`Mod5Mask or m5m'
     Modifier is set to

`AnyModifier or any'
     Modifier is set to any of the modifier

`none or 0'
     No modifier is used You can also specify the keycode for the
modifier you wish to use

Invoking Xnee
=============

   The mode(s) Xnee shall use and the ranges to use can be set by
either:
   * command line options

   * plugin file

   * recorded file (only apllicable when in replay mode)
   The three can be used together or alone. However, when given
multiple specifications to a setting that can take one value (e.g
printout redirection, number of data to record) the latest
specification is used.

Command line syntax
-------------------

   To get information about how to use Xnee's command line options
please use the man page(s).

Plugin file
-----------

   To use a plugin file use the `--plugin' option,  e.g `xnee --plugin
xnee/plugins/netscape.xns'

Recorded file
-------------

   To use a recorded file use the `--file' option,  e.g `xnee --file
user1_session.xnee'

Stopping Xnee
=============

   Stopping Xnee when recording or replaying can be done as follows
   * user specified modifier and key

   * number of data to record

   * sending a SIGTERM signal (e.g pressing Control-c in a terminal
     window)

user specified modifier and key
-------------------------------

   It is possible to specify a modifier (e.g Control button) and a key
(e.g 'a') that will stop the Xnee session. When using this option make
sure that the modifier/key is not used in any way by the applications
you recording.

number of data to record
------------------------

   By specifying the number of data to record Xnee stops when this
number num,ber of data is received from the server. When replaying the
same amount of data is replayed.

sending a SIGTERM signal (e.g pressing CTRL-C in a terminal window)
-------------------------------------------------------------------

   The easiest way to send a signal to a process is by launching Xnee
from a terminal window (e.g xterm). By pressing Control-c xterm sends
the SIGTERM signal to Xnee. When replaying it can sometimes be hard to
move the pointer into the terminal window (e.g if a lot of motion
events were recorded that will let you compete with Xnee on where the
mouse pointer shall be located. Beleive me, you'll end up lossing that
battle).

Xnee Installation
*****************

Installation from source (tar.gz) with the configure script
===========================================================

   To unpack, build and install Xnee from the sourcefiles do the
following:
`Download the source files into a directory'

`Unzip the source file'
     `gunzip xnee-1.0.tar.gz'

`Untar the source file'
     `gunzip xnee-1.0.tar'

`Enter the Xnee directory'
     `gunzip cd xnee-1.0'

`Generate the makefiles'
     `./configure --prefix=<PATH TO INSTALLATION DIR>'

`Build Xnee'
     `make clean all'

`Install (as root)'
     `make install'

Installation from source (tar.gz) with default Makefile
=======================================================

   To unpack, build and install Xnee from the sourcefiles do the
following:
`Download the source files into a directory'

`Unzip the source file'
     `gunzip xnee-1.0.tar.gz'

`Untar the source file'
     `gunzip xnee-1.0.tar'

`Enter the Xnee directory'
     `gunzip cd xnee-1.0'

`Build Xnee'
     `make -f Makefile.xnee clean all'

`Copy the Xnee binary (src/cli/xnee) to a directory'
     E.g `cp src/cli/xnee /usr/local/bin'

Installation from SOURCE RPM
============================

Installation from RPM
=====================

   Use the rpm command.  E.g `rpm --install xnee-0.9-1.i386.rpm'

Installation from CVS
=====================

   See the Xnee Developer Manual

Deinstallation
**************

Xnee usage examples
*******************

Getting started
===============

Recorder
========

   TBD

Replayer
========

   TBD

Distributor
===========

   TBD

Xnee synchronisation
********************

Why synchronise
===============

   To understand why synchronisation during replay is needed an example
is given.

   In this example only mouse and keyboard events are recorded. Think
of a session with a web browser.

   During record the following is done:
   * Start galeon (or another web browser) via the GNOME panel

   * Press Ctrl-O which pops up a window

   * Press the left button in the textfield of the popup window

   * Enter the URL you want to enter (e.g http://www.gnu.org)

   * Clock on the OK button

   * Then click on another URL (e.g GNU Documentation)

   * Then click on another URL (e.g On-Line Documentation)

   When replaying this session it is often to synchronise the recorded
session with what's happening "right now" on the display since
sometimes (or rather always) there can be different response times from
the same URL.

   During replay the following is done:
   * Galeon is started

   * Ctrl-O is typed which pops up a window

   * Press the left button in the textfield of the popup window

   * Enter the URL you want to enter (e.g http://www.gnu.org)

   * Clock on the OK button

   * ... due to an enormous amount of visitors the GNU web server can't
     respond as quick as it did when recording. So when the next thing
     happens

   * Then click on another URL (e.g GNU Documentation)

   * ... the page hasn't been loaded and when the next event is replayed

   * Then click on another URL (e.g On-Line Documentation)

   * ... the link isn't there and we're really out of sync with the
     recorded session

How to synchronise
==================

   Instead we could record some more data than just the mouse and
keyboard events.

   During record the following is done:
   * Start galeon (or another web browser) via the GNOME panel

   * Record some X data that tells us that a window have been created

   * Press Ctrl-O which pops up a window

   * Record some X data that tells us that a window have been created

   * Press the left button in the textfield of the popup window

   * Enter the URL you want to enter (e.g http://www.gnu.org)

   * Clock on the OK button

   * Record some X data that tells us that a window have been destroyed

   * Then click on another URL (e.g GNU Documentation)

   * Record some X data that tells us that a some text has been
     displayed in a window

   * Then click on another URL (e.g On-Line Documentation)

   * Record some X data that tells us that a some text has been
     displayed in a window
   The non-mouse-or-keyboard events recorded (window created & text
displayed) are record for synchronisation purposes.

   During replay the following is done:
   * Start galeon (or another web browser) via the GNOME panel

   * wait for: the recorded X data to be sent again

   * Press Ctrl-O which pops up a window

   * wait for: the recorded X data to be sent again

   * Press the left button in the textfield of the popup window

   * Enter the URL you want to enter (e.g http://www.gnu.org)

   * Clock on the OK button

   * wait for: the recorded X data to be sent again

   * Then click on another URL (e.g GNU Documentation)

   * wait for: the recorded X data to be sent again

   * Then click on another URL (e.g On-Line Documentation)

   * wait for: the recorded X data to be sent again

Synchronisation is needed
=========================

   So by recording more data than just the events to be replayed we can
synchornise what was recorded with what is going on when replaying. But
the data has to be choosen with respect to that the data:
   * differs from different sessions (Gimp and Xterm are really
     different)

   * slows down the replay session if there are too many

   * is hard to choose since the X protocol is rich

   * differs (comparing record and replaying)

   * can have different ordering (comparing record and replaying)

Different data for different kind of sessions
---------------------------------------------

   If we record an xterm session with all data being recorded and
compare that to a recorded GIMP session with all data being recordr we
can see that the data to use as synchronisation data differs. AS an
example there aren't so many windows created/destryed during an xterm
session.

   The solve to the the problem of finding out what data to use as
synchronisation data one can:
   * use the plugin files delivered with Xnee

   * analyse the application (using Xnee's  `--human_printouts' option)
     and do some "trial and error"

Slow replay session due to too many synchronise data
----------------------------------------------------

   The synchronisation itself doesn't take much time but there are
timeouts that makes Xnee paues for a short while (see above). If there
are many such timeouts it will lead to a slow replaying session.

X protocol is rich
------------------

   For an end user (with no X expertise) it is hard to read the X
protocol specification and make assumptions on what data to use.

Different data sent
-------------------

   Even if one starts up a machine from scratch (reboot) when recording
and from scratch when replaying there is no guarantee that the data is
sent in the same order or that exactly the same amount of data is sent.

Buffers and timeouts
====================

   To enable synchronisation Xnee buffers data:
   * that was recorded but hasn't been sent during replay

   * that was sent during replay but hasn't been seen in the recorded
     file

   For every data during replay that hasn't been sent (as when
recorded) Xnee pauses for a short while. If the data is sent to Xnee,
everything is fine. If the data isn't sent it is stored in the buffer
of unsynchronised data. If the number of unsynchronise data is getting
to high, Xnee will eventually exit with an error code (see man page(s)).

Xnee Requirements
*****************

Runtime requirements
====================

   Xnee requirements:
   * RECORD extension

   * XTest extension
   You can use Xnee in replaying without RECORD extension if
synchronisation is turned off.

Development requirements
========================

   For development requirements, please look at the DEVELOPMENT file
that is distributed with all packages and with CVS.

Xnee FAQ
********

`Can Xnee record more than one display?'
     No, but I am considering adding the functionality (see the TODO
     file)

`Will you put up a source tree so that I can join ?'
     You can find a CVS tree (soon) at Sourceforge.   You are more than
     welcome to join

`Can I write a GUI frontend for you ?'
     Yes !

`What license is Xnee released under ?'
     GPL  <http://www.gnu.org/copyleft/gpl.html>

`Why GPL?'
     I consider my programs as:
        * a fun way for me to (hopefully) become a better programmer

        * a sort of payback for my operating systems (GNU/Linux and
          OpenBSD)

        * a way to make free operating systems better and more widely
          used than XXX
      And of course I think it would be a great kick for my ego to have
     other  people using my programs (especially if the alternative is
     a non-free program on a non-free operating system).

`Why the name Xnee?'
     I wanted to use a recursive acronym, as GNU ("GNU's Not Unix').
     After having read the Wine documentation, I thought that Xnee is
     not an Event Emulator would work fine. Since Xnee is Not an Event
     Emulator but rather a XEvent generator. Emulation is not part of
     the game here....    .... it just sounds nice!

`Can you add xxx functionality to Xnee'
     Send an email to <xnee@sandklef.com> and I'll consider it.

`When starting Xnee I get noticed that I am missing RECORD extension'
     Your X server doesn't have the RECORD extension either loaded or
     compiled. TO solve this you have to, depending on what Xserver you
     have do the following:

        * XFree86 4.0 and higher Make sure that the RECORD extension is
          loaded. This is done by letting the Module section in the X
          config file (e.g /etc/X11/XF86Config-4) look something like:

          `Section "Module"'
          `Load  "dbe"             # Double-buffering'
          `Load  "GLcore"          # OpenGL support'
          `Load  "dri"             # Direct rendering infrastructure'
          `Load  "glx"             # OpenGL X protocol interface'
          `Load  "extmod"          # Misc. required extensions'
          `Load  "v4l"             # Video4Linux'
          `# Load  "pex5"          # PHIGS for X 3D environment
          (obsolete)'
          `Load  "record"  # X event recorder'
          `# Load  "xie"           # X Image Extension (obsolete)'
          `# You only need the following two modules if you do not use
          xfs.'
          `# Load  "freetype"       # TrueType font handler'
          `# Load  "type1"         # Adobe Type 1 font handler'
          EndSection

          The important load directive (in this case) is the following
          line
          `Load  "record"  # X event recorder'
        * X.org, XFree86 (3.3 and lower)  or any other Xserver
          Recompile and reinstall the Xserver and make sure that RECORD
          extension is built into the Xserver. Please look at the
          documentation from your Xserver "vendor" on how to do that.

`Where do I send questions?'
     <xnee@sandklef.com>

* Menu:


Tag Table:
Node: Top298

End Tag Table
