java.lang.Object | +--fit.Fixture | +--fit.ActionFixture | +--com.objectmentor.fixtures.CommandLineFixture
A FIT test fixture that provides shell-like behavior to a FIT table. It allows you to run commands, and search their output. It allows you to invoke any shell command, either synchronously or asynchronously. It allows you to create and test files. The table rows are executed in order, from top to bottom. At the end of the table any processes that are still running are terminated and their stdout and stderr streams gathered into the cell that specified their command.
Inner classes inherited from class fit.Fixture |
fit.Fixture.Counts, fit.Fixture.RunTime |
Fields inherited from class fit.ActionFixture |
actor |
Fields inherited from class fit.Fixture |
counts, summary |
Constructor Summary | |
CommandLineFixture()
|
Method Summary | |
void |
command()
Execute and wait for a command to complete. |
void |
contains()
searches the existing output of the specified stream for the specified target string. |
void |
createFile()
Creates a file with the specified name and the specified contents. |
void |
definition()
creates a macro that will be replaced in all command and spawn commands. |
void |
doTable(fit.Parse table)
Private function -- ignore. |
void |
fileExists()
checks to see if a file exists. |
void |
find()
searches the specified stream for the specified string. |
void |
pause()
pauses execution of the table for the specified number of seconds |
void |
spawn()
Starts a command but does not wait for it to finish. |
void |
title()
prints a message on stdout of the FIT runner. |
void |
verbose()
turns on verbose output. |
void |
verboseOff()
turns verbose output off. |
void |
waitFor()
Wait for a spawned process to complete. |
Methods inherited from class fit.ActionFixture |
check, doCells, enter, press, start |
Methods inherited from class fit.Fixture |
camel, check, counts, doCell, doRow, doRows, doTables, escape, escape, exception, gray, ignore, label, parse, right, wrong, wrong |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommandLineFixture()
Method Detail |
public void command()
spawn()
public void contains() throws java.lang.Exception
streamId
- See find().target
- See find().find()
public void createFile()
filename
- The name of the file to create. This can be a pathname.contents
- This string, which can contain many lines, is written to the file.
Currently this operation unescapes &" sequences into double quotes.public void definition()
name
- The name of the macro. My convention has been to use all
all uppercase for macro names, just as in C.contents
- The string that will replace the macro. This string can
contain other macros.public void doTable(fit.Parse table)
doTable
in class fit.Fixture
public void fileExists()
filename
- The name of the file to check. This can be a path.public void find() throws java.lang.Exception
stream
- The stream to search. This stream is specified with the syntax
processId.streamId. The processId is from the spawn or command
method. The streamId is either 'stdout' or 'stderr'. Thus
'server.stdout' is the streamId for stdout of the server process.target
- The string to search for. No regular expressions are used right now.contains()
public void pause() throws java.lang.Exception
seconds
- the number of seconds to pause the table.public void spawn() throws java.lang.Exception
command
- The command to executeprocessId
- An identifier for the process. This identifier can be used with other
directives such as find, contains, and waitFor to reference the process
and the stdout and stderr streams. This field can be left blank.public void title()
string
- The string to print on stdout.public void verbose()
verboseOff()
public void verboseOff()
verbose()
public void waitFor()
processId
- The processId of the process to wait for.