Trees | Indices | Help |
---|
|
process.user.ProcessUser --+ | BaseTest
The base class for all PySys testcases.
BaseTest is the parent class of all PySys system testcases. The class provides utility functions for cross-platform process management and manipulation, test timing, and test validation. Any PySys testcase should inherit from the base test and provide an implementation of the abstract execute method defined in this class. Child classes can also overide the setup, cleanup and validate methods of the class to provide custom setup and cleanup actions for a particual test, and to perform all validation steps in a single method should this prove logically more simple.
Execution of a PySys testcase is performed through an instance of the
pysys.baserunner.BaseRunner class, or a subclass
thereof. The base runner instantiates an instance of the testcase, and
then calls the setup
, execute
,
validate
and cleanup
methods of the instance.
All processes started during the test execution are reference counted
within the base test, and terminated within the cleanup
method.
Validation of the testcase is through the assert*
methods. Execution of each method appends an outcome to an internal data
structure thus building up a record of the individual validation
outcomes. Several potential outcomes are supported by the PySys framework
(SKIPPED
, BLOCKED
, DUMPEDCORE
,
TIMEDOUT
, FAILED
, NOTVERIFIED
, and
PASSED
) and the overall outcome of the testcase is
determined using a precedence order of the individual outcomes. All
assert*
methods support variable argument lists for common
non-default parameters. Currently this only includes the
assertMessage
parameter, to override the default statement
logged by the framework to stdout and the run log.
|
|||
|
|||
|
|||
|
|||
integer |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
handle |
|
||
|
|||
|
|||
|
|||
handle |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
string |
input Location for input to any processes (defaults to current working directory) |
||
logging.Logger |
log Reference to the logger instance of this class |
||
string |
mode The user defined mode the test is running within. |
||
string |
output Location for output from any processes (defaults to current working directory) |
||
Project |
project Reference to the project details as set on the module load of the launching executable |
||
string |
reference Full path to the reference directory of the testcase. |
|
Create an instance of the BaseTest class.
|
Set the xargs as data attributes of the test class. Values in the xargs dictionary are set as data attributes using the
builtin
|
Add a test validation outcome to the validation list. The method provides the ability to add a validation outcome to the internal data structure storing the list of test validation outcomes. In a single test run multiple validations may be performed. The currently supported validation outcomes are: SKIPPED: An execution/validation step of the test was skipped (e.g. deliberately) BLOCKED: An execution/validation step of the test could not be run (e.g. a missing resource) DUMPEDCORE: A process started by the test produced a core file (unix only) TIMEDOUT: An execution/validation step of the test timed out (e.g. process deadlock) FAILED: A validation step of the test failed NOTVERIFIED: No validation steps were performed INSPECT: A validation step of the test requires manual inspection PASSED: A validation step of the test passed The outcomes are considered to have a precedence order, as defined by
the order of the outcomes listed above. Thus a
|
Get the overall outcome of the test based on the precedence order. The method returns the overal outcome of the test based on the
outcomes stored in the internal data structure. The precedence order of
the possible outcomes is used to determined the overall outcome of the
test, e.g. if The method returns the integer value of the outcome as defined in
pysys.constants. To convert this to a string representation use the
|
Execute method which must be overridden to perform the test execution steps.
|
Cleanup method which performs cleanup actions after execution and validation of the test. The cleanup method performs actions to stop all processes started in the background and not explicitly killed during the test execution. It also stops all process monitors running in seperate threads, and any instances of the manual tester user interface. Should a custom cleanup for a subclass be required, the BaseTest cleanup method should first be called. e.g. : class MyTest(BaseTest): def cleanup(self): # call base test cleanup first BaseTest.cleanup(self) # perform custom cleanup actions ... |
Start a process running in the foreground or background, and return the process handle. The method allows spawning of new processes in a platform independent
way. The command, arguments, environment and working directory to run the
process in can all be specified in the arguments to the method, along
with the filenames used for capturing the stdout and stderr of the
process. Processes may be started in the This method uses the pysys.process.helper module to start the process. On
failure conditions the method may append
|
Send a soft or hard kill to a running process to stop its execution. This method uses the pysys.process.helper module to stop a running process.
Should the request to stop the running process fail, a
|
Send a signal to a running process (Unix only). This method uses the pysys.process.helper module to send a signal to a
running process. Should the request to send the signal to the running
process fail, a
|
Wait for a process to terminate, return on termination or expiry of the timeout.
|
Start a separate thread to log process statistics to logfile, and return a handle to the process monitor. This method uses the pysys.process.monitor module to perform logging of the
process statistics, starting the monitor as a seperate background thread.
Should the request to log the statistics fail a
|
Stop a process monitor.
|
Start the manual tester. The manual tester user interface (UI) is used to describe a series of
manual steps to be performed to execute and validate a test. Only a
single instance of the UI can be running at any given time, and can be
run either in the
|
Wait for a specified period of time.
|
Perform a validation assert on the supplied expression evaluating to true. If the supplied expression evaluates to true a
|
Perform a validation assert on the supplied expression evaluating to false. If the supplied expression evaluates to false a
|
Perform a validation assert on the comparison of two input text files. This method performs a file comparison on two input files. The files
are pre-processed prior to the comparison to either ignore particular
lines, sort their constituent lines, replace matches to regular
expressions in a line with an alternate value, or to only include
particular lines. Should the files after pre-processing be equivalent a
|
Perform a validation assert on a regular expression occurring in a text file. When the
|
Perform a validation assert on a regular expression occurring in the last line of a text file. When the
|
Perform a validation assert on a list of regular expressions occurring in specified order in a text file. When the
|
Perform a validation assert on the number of lines in a text file matching a specific regular expression. This method will add a
|
Allocate a TCP port which is available for a server to be started on. Take ownership of it for the duration of the test |
Return an assert statement requested to override the default value.
|
|
inputLocation for input to any processes (defaults to current working directory)
|
modeThe user defined mode the test is running within. Subclasses can use this in conditional checks to modify the test execution based upon the mode.
|
outputLocation for output from any processes (defaults to current working directory)
|
referenceFull path to the reference directory of the testcase. This is used both by the class and its subclasses to locate the default directory containing all reference data to the testcase, as defined in the testcase descriptor.
|
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Aug 15 14:58:00 2014 | http://epydoc.sourceforge.net |