CmdWindow Methods
ClearScreen
Clears the current console session by running the "cls" command.
Syntax:
EnterText
Enters the specified text in the console and verifies the input.
Syntax:
Parameters:
Parameter
Description
textToEnter
MakeReadyForNewCommand
Makes sure the console is ready for a new command. Clears existing input text that is not run yet and aborts a running command with Ctrl+C if necessary.
Syntax:
Parameters:
Parameter
Description
[throwException]
Return Value:
True if console is ready for a new command, false or exception otherwise.
Exceptions:
Exception
Condition
Command window was not ready for a new command
RunCommand
Enters the provided command and runs it by pressing enter. Returns as soon as the first output of the command is received (on the next line) or the command completes. If your command logs output to the console you probably want to follow RunCommand with WaitForCmdToComplete
Example to run you own command from a test case:
Syntax:
Parameters:
Parameter
Description
command
[timeoutInSeconds]
Exceptions:
Exception
Condition
Command did not complete within timeoutInSeconds.
VerifyText
Verifies the expected text appears in the output of the last command. Allows to pass in different variants of the text in order to allow for different localisations.
Syntax:
Parameters:
Parameter
Description
expectedTextWithVariants
[lastCmd]
Return Value:
Returns true if one of the text variants appears in the output of the last command or the command itself.
WaitForCmdToComplete
Waits for a command to complete by waiting until the console is ready for a new command. Note: an input request is not considered a completed command and will mostly likely timeout the method.
Syntax:
Parameters:
Parameter
Description
[timeout]
[throwException]
Return Value:
True if command is completed within the specified timeout, false or exception otherwise.
Exceptions:
Exception
Condition
Command did not complete within timeoutInSeconds and throwException is true.
Last updated