expliot.expliot

Main part to start.

Attributes

BANNER

Classes

TLog

Representation of a Test Log.

Cli

The main command line interpreter for EXPLIoT console.

EfCli

The interactive console and CLI interface for EXPLIoT framework.

Module Contents

expliot.expliot.BANNER
class expliot.expliot.TLog

Representation of a Test Log.

Logger class for logging test case output. By default log to sys.stdout Must not instantiate. Use class methods. The logger needs to be initialized with the output file using init() class method

SUCCESS = 0
FAIL = 1
TRYDO = 2
GENERIC = 3
_prefix = ['[+]', '[-]', '[?]', '[*]']
_errprefix = '[.]'
_file
classmethod init(file=None)

Initialize the file object.

This method should be called in the beginning of the application to open the log output file.

Parameters:

file – The file where to log the test output

Returns:

classmethod close()

Close the file object if it is not sys.stdout.

Returns:

classmethod print(prefixtype, message)

The actual print methods.

Write the formatted message to the _file file.

Args:

prefixtype(int): the prefix type to be used for the message (defined above) message(str): The actual message from the Test object

Returns:

Nothing

classmethod success(message)

Write a message with success prefix to the file.

Parameters:

message – The message to be written

Returns:

classmethod fail(message)

Write a message with fail prefix to the file.

Parameters:

message – The message to be written

Returns:

classmethod trydo(message)

Write a message with try prefix to the file.

Parameters:

message – The message to be written

Returns:

void

classmethod generic(message)

Write a message with success prefix to the file.

Parameters:

message – The message to be written

Returns:

void

class expliot.expliot.Cli(prompt=None, intro=None)

Bases: cmd2.Cmd

The main command line interpreter for EXPLIoT console.

It inherits Cmd2 package for commandline functionality and adds EXPLIoT specific commands. It also initializes the plugins for execution.

Current EXPLIoT commands defined are:

  1. list: To list available plugins (test cases)

  2. run: Execute a specific plugin (test case)

  3. exit: An alias for Cmd2 quit command

del_defaultcmds()

Delete/remove the default commands from cmd2.

Args:

None

Returns:

Nothing

do_list(args)

List the available plugins (test cases).

do_run(arglist)

Execute a specific plugin (test case). For details: ef> run -h.

complete_run(text, line, start_index, end_index)

Tab completion method for run command.

It shows the list of available plugins that match the subcommand specified by the user.

Args:

text (str): Run subcommand string specified by the user line (str): The whole run command string typed by the user start_index (int): Start index subcommand in the line end_index (int): End index of the subcommand in the line

Returns:

List of matching subcommands(plugins)

runtest(name, arglist)

Run a single test case from the TestSuite if it exists.

Args:

name (str): Name of the plugin (test case) to run arglist (list): Argument list to be passed to the plugin for parsing

Returns:

Nothing

class expliot.expliot.EfCli

The interactive console and CLI interface for EXPLIoT framework.

cli
classmethod main()

Run a single command given on the command line.

Or run the main command loop of the console if no command line arguments given.

Returns: