Software Testing Automation Framework (STAF)
Software Testing Automation Framework (STAF)
What is STAF?
An open source automation framework A remote test agent to control tests on multiple machines Designed around the idea of reusable components, called services Developed by IBM, made open source because of their use in Linux testing
Supported Environments
Runs on most operating systems: Windows, Unix, AS/400, MVS The same services are available from a wide array of languages, including C/C++, Java, Perl, Tcl, Python and Rexx There is also a command line interface
Basic Concepts
Runs as a daemon process, called STAFProc, on each system Operates in a peer-to-peer environment; in other words, there is no client-server hierarchy
Services
Services are reusable components that provide all the capabilities in STAF Provides a specific set of functionality (such as Logging) and defines a set of requests that it will accept STAFProc sends the requests to services as strings which describe the operation to perform Requests can be sent to services on the local machine or to another remote machine
Each handle has a priority-based message queue associated with it Applications receive messages sent from other processes/machines on their queue
Variables
STAF provides facilities to store and retrieve variables per handle, such as
Configuration information Runtime/state information System environment information
Live within the STAFProc daemon, which allows them to be dynamically updated
After the update, applications referencing the variable will get the new value
Security
Security defined at the machine level, as opposed to using individual userids Numeric trust level can be assigned to specific machines Each service defines what trust level is required in order to use the various functions provided A simple numerical comparison is used to see if the request is authorized
Types of Services
Internal STAF Services
The executable code for internal STAF services resides within STAFProc, which means they are always available and have a fixed name
Some Services
SERVICE FS PROCESS LOG MONITOR SXE SEM CRON EVENT TIMER List services available and examine requests Get and copy files across a network Start, stop and query processes Full featured logging facility, can be replaced Publish test case running execution status Sequentially execute a number of commands Networkable event and mutex semaphores Run a command at specific time interval Publish/Subscribe notification system Periodically receive a notification message
Configuration File
STAF is configured through a text file
This file may have any name you desire, but the default is STAF.cfg
Configuration File
Grant access with trust levels
TRUST LEVEL 5 MACHINE office TRUST LEVEL 0 MACHINE badguy TRUST DEFAULT LEVEL 1
Service Loaders
External services whose purpose is to load other services on-demand They dynamically register the service when a request is made A default service loader service (STAFDSLS) is shipped with STAF. It knows how to dynamically load the Log, Monitor, and ResPool services. This service will automatically be configured
serviceloader Library STAFDSLS
You can choose when/if you enable STAF in your test cases
staf local process start shell command "perl SimpleTestcase.pl"
STAF::WrapData
This function takes a string and produces the colon-lengthcolon delimited version of that string. This function is widely used to pass the values of options in STAF requests.
STAX Service
A test harness and test execution language with an XML based grammar Provides a powerful GUI monitoring application The language has a number of unique logic primitives
Parallel iterate command: each iteration is run concurrently in a separate thread
Each service requires a unique package name Only works with Perl 5.8 or later Threads and shared threads allow requests to modify data without corruption