Package qm :: Package test :: Package classes :: Module command :: Class ExecTestBase
[hide private]
[frames] | no frames]

Class ExecTestBase

source code

         object --+            
                  |            
extension.Extension --+        
                      |        
      runnable.Runnable --+    
                          |    
                  test.Test --+
                              |
                             ExecTestBase

Check a program's output and exit code.

An 'ExecTestBase' runs a program and compares its standard output, standard error, and exit code with expected values. The program may be provided with command-line arguments and/or standard input.

The test passes if the standard output, standard error, and exit code are identical to the expected values.

Nested Classes [hide private]

Inherited from test.Test: OutcomeField, TestField

Inherited from runnable.Runnable: ResourceField

Inherited from extension.Extension: Type, __metaclass__

Instance Methods [hide private]
 
MakeEnvironment(self, context)
Construct the environment for executing the target program.
source code
 
ValidateOutput(self, stdout, stderr, result)
Validate the output of the program.
source code
 
RunProgram(self, program, arguments, context, result)
Run the 'program'.
source code
 
__CompareText(self, s1, s2)
Compare 's1' and 's2', ignoring line endings.
source code

Inherited from test.Test: GetTargetGroup, Run

Inherited from runnable.Runnable: GetAttachments, GetDatabase, GetId, __init__

Inherited from extension.Extension: GetClassName, GetExplicitArguments, MakeDomDocument, MakeDomElement, Write, __getattr__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  arguments = [qm.fields.TextField(name= "stdin", title= "Standa...
A list of the arguments to the extension class.

Inherited from test.Test: PREREQUISITES_FIELD_ID, kind

Inherited from runnable.Runnable: EXTRA_DATABASE, EXTRA_ID, RESOURCE_FIELD_ID, resources

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

ValidateOutput(self, stdout, stderr, result)

source code 

Validate the output of the program.

'stdout' -- A string containing the data written to the standard output stream.

'stderr' -- A string containing the data written to the standard error stream.

'result' -- A 'Result' object. It may be used to annotate the outcome according to the content of stderr.

returns -- A list of strings giving causes of failure.

RunProgram(self, program, arguments, context, result)

source code 

Run the 'program'.

'program' -- The path to the program to run.

'arguments' -- A list of the arguments to the program. This list must contain a first argument corresponding to 'argv[0]'.

'context' -- A 'Context' giving run-time parameters to the test.

'result' -- A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modified by this method to indicate outcomes other than 'Result.PASS' or to add annotations.

__CompareText(self, s1, s2)

source code 

Compare 's1' and 's2', ignoring line endings.

's1' -- A string.

's2' -- A string.

returns -- True if 's1' and 's2' are the same, ignoring differences in line endings.


Class Variable Details [hide private]

arguments

A list of the arguments to the extension class.

Each element of this list should be an instance of 'Field'. The 'Field' instance describes the argument.

Derived classes may redefine this class variable. However, derived classes should not explicitly include the arguments from base classes; QMTest will automatically combine all the arguments found throughout the class hierarchy.

Value:
[qm.fields.TextField(name= "stdin", title= "Standard Input", verbatim=\
 "true", multiline= "true", description= """The contents of the standa\
rd input stream.

            If this field is left blank, the standard input stream wil\
l
            contain no data."""), qm.fields.SetField(qm.fields.TextFie\
ld(name= "environment", title= "Environment", description= """Addition\
...