Package tlib :: Package base :: Module TestHelper
[hide private]
[frames] | no frames]

Module TestHelper

source code

Classes [hide private]
  Singleton
Functions [hide private]
 
tlib_folder()
Returns tlib's absolute path
source code
 
tlib_asset_folder()
Returns absolute path of tlib's asset folder
source code
 
tlib_modules_folder()
Returns absolute path of folder containing all modules
source code
 
tlib_config_folder()
Returns absolute path of tlib's config folder
source code
 
tlib_template_folder()
Returns absolute path of tlib's template folder
source code
 
webdriver_chrome_executable(version='latest')
Returns path to Chrome WebDriver executable
source code
 
webdriver_ie_executable()
Alias for webdriver_ie32_executable
source code
 
webdriver_ie32_executable()
Returns path to IE WebDriver executable
source code
 
webdriver_ie64_executable()
Returns path to IE WebDriver executable
source code
 
android_server_apk()
Returns path to Webdriver for android
source code
 
selendroid_server_jar()
Returns path to selendroid jar for android native app
source code
 
is_valid_ip(ip)
Returns true if IP parameter is a valid IP address.
source code
list
run_command(logger, command, shell=False, fail_on_error=True)
Run a command and skip test if exit code is not 0
source code
list
start_process(logger, command, shell=False)
Run a command and skip test if exit code is not 0
source code
list
sort_list(l)
Sorts a list, and if the list has other objects inside, it will iterate over them
source code
dict
sort_dict(d)
Sorts a dictionary, and if the list has other objects inside, it will iterate over them
source code
 
log_rest_request(response, logger)
Logs REST request and response
source code
Variables [hide private]
  __package__ = 'tlib.base'
Function Details [hide private]

tlib_template_folder()

source code 

Returns absolute path of tlib's template folder

Template folder contains jinja templates used for generation of reports

like screenshots

is_valid_ip(ip)

source code 

Returns true if IP parameter is a valid IP address.

Currently IPs in this format are valid:

X.X.X.X

X.X.X.X:PORT

Parameters:
  • ip (str)
Returns:
bool

run_command(logger, command, shell=False, fail_on_error=True)

source code 

Run a command and skip test if exit code is not 0

Example: Run 'adb devices' and don't skip test if commands returns non-zero status run_command(logger, ["adb", "devices"], fail_on_error=False)

Parameters:
  • logger (logging.Logger) - logger for debugging purposes
  • command (list) - Command to run
  • fail_on_error (bool) - When True, skip test if command returned a non-zero exit code
Returns: list
Returns a list with stdout and stderr output

start_process(logger, command, shell=False)

source code 

Run a command and skip test if exit code is not 0

Example: Run 'adb devices' and don't skip test if commands returns non-zero status run_command(logger, ["adb", "devices"], fail_on_error=False)

Parameters:
  • logger (logging.Logger) - logger for debugging purposes
  • command (list) - Command to run
  • fail_on_error (bool) - When True, skip test if command returned a non-zero exit code
Returns: list
Returns a list with stdout and stderr output

sort_list(l)

source code 

Sorts a list, and if the list has other objects inside, it will iterate over them

Parameters:
  • l (list) - list to sort
Returns: list
sorted list

sort_dict(d)

source code 

Sorts a dictionary, and if the list has other objects inside, it will iterate over them

Parameters:
  • d (dict) - dictionary to sort
Returns: dict
sorted dictionary

log_rest_request(response, logger)

source code 

Logs REST request and response

:param response: Object returned by requests class :type response: Response :param logger: Where to log request and response :type logger: logging.Logger