Package: universal-test-tool
universal-test-toolAwesome universal-test-tool to make tests configurable with a yaml file.Install the repositorypipinstalluniversal-test-toolRun the teststest-tool# This programm is a tool for running tests.# options:#   -h, --help            show this help message and exit#   -p PROJECT, --project PROJECT#                         The path to the project.#   -ca CALLS, --calls CALLS#                         The filename of the calls configuration.#   -d DATA, --data DATA  The filename of the data configuration.#   -X, --debug           Activate debugging.Calls FilePer default a filecalls.yamlis searched in the project folder, which is by default the current working directory.It is a list where every entry is one step to test.The tests are done in the following available plugins:Assert (test_tool_assert_plugin)Copy Files SSH (test_tool_copy_files_ssh_plugin)JDBC SQL (test_tool_jdbc_sql_plugin)Read Jar Manifest (test_tool_read_jar_manifest_plugin)Rest (test_tool_rest_plugin)Run Process (test_tool_run_process_plugin)Selenium (test_tool_selenium_plugin)SQL Plus (test_tool_sql_plus_plugin)SSH Cmd (test_tool_ssh_cmd_plugin)Assert (test_tool_assert_plugin)Make an assertion.Call:-type:ASSERTcall:value:Noneexpected:Noneoperator:==error_msg:The value is not as expected.Parameters:ParameterDefaultDescriptionvalueNoneThe given value.expectedNoneThe expected value.operator==One of the supported operations (==, !=, <, <=, >, >=).error_msgThe value is not as expected.The error message for the logs.Copy Files SSH (test_tool_copy_files_ssh_plugin)Copies files and folders between local machine and remote machine via ssh.Call:-type:COPY_FILES_SSHcall:user:${REMOTE_CMD_USER}password:${REMOTE_CMD_PASSWORD}host:${REMOTE_CMD_HOST}local_path:Noneremote_path:Nonedownload:FalseParameters:ParameterDefaultDescriptionuser${REMOTE_CMD_USER}The user for the ssh connection.password${REMOTE_CMD_PASSWORD}The password for the ssh connection.host${REMOTE_CMD_HOST}The host for the ssh connection.local_pathNoneThe local file or folder for the transfer.remote_pathNoneThe remote file or folder for the transfer.downloadFalseIf this flag is set to true, the file transfer is a download, otherwise it is an upload.JDBC SQL (test_tool_jdbc_sql_plugin)Runs SQL Statements withJayDeBeApi.Call:-type:JDBC_SQLcall:query:None,save:[],validate:[],driver:${DB_DRIVER},driver_path:${DB_DRIVER_PATH},url:${DB_URL},username:${DB_USERNAME},password:${DB_PASSWORD}Object for save:save:raw:Nonecolumn:Nonename:NoneObject for validate:save:raw:Nonecolumn:Nonevalue:NoneParameters:ParameterDefaultDescriptionqueryNoneThe SQL statement to runsave[]Save a entry of a cell to a variablevaidate[]Validate the entry of a celldriver${DB_DRIVER}The Class of the driverdriver_path${DB_DRIVER_PATH}The Path of the jar fileurl${DB_URL}The jdbc connection stringusername${DB_USERNAME}The username of the dbpassword${DB_PASSWORD}The password of the dbRead Jar Manifest (test_tool_read_jar_manifest_plugin)Unpacks a jar file and parses and prints the manifest file to the logger. It also optionally saves a value.Call:-type:READ_JAR_MANIFESTcall:jar_path:${PATH_JAR_FILE}manifest_path:META-INF/MANIFEST.MFsave:[]Object for save:save:name:Nonekey:NoneParameters:ParameterDefaultDescriptionjar_path${PATH_JAR_FILE}The absolute or relative path to the jar file.manifest_pathMETA-INF/MANIFEST.MFThe path within the jar file to the manifest.saveNoneSave values of the result to a variable with the given name.Parameters for save:ParameterDefaultDescriptionnameNoneThe name for the variable to save the result in.keyNoneThe key of the parsed manifest.Rest (test_tool_rest_plugin)Tests REST endpoints.Call:-type:RESTcall:base_url:${REST_BASE_URL}path:${REST_PATH}url:Nonemethod:GETdata:Nonefiles:Nonepayload:Noneheaders:{}response_type:JSONassertion:Nonehide_logs:Falsestatus_codes:[200]Parameters:ParameterDefaultDescriptionbase_url${REST_BASE_URL}The base url of the service to test.path${REST_PATH}The path of the endpoint to test.urlNoneThe url value is built dynamically from ${base_url}/${path} if not set. Otherwiese the other values are ignored.methodGETThe method of the call. (GET, POST, DELETE, PUT)dataNoneThe data of the http call, an object is used as json.filesNonePath of files to send.payloadNonePayload for multipart request.header{}Headers to use for request.response_typeJSONHow to pasrse the response. (JSON, XML, TEXT)assertionNONEThe assertion how the response should look likehide_logFalseDon't print the reply in the logs.status_codes[200]The status codes to accept.Run Process (test_tool_run_process_plugin)Start a subprocess on the local machine.Call:-type:RUN_PROCESScall:cmd:Nonetimeout:Nonesave:Noneshell:Truetext:Trueprogram:'/bin/bash'return_code:NoneObject for save:save:name:Nonetype:NoneParameters:ParameterDefaultDescriptioncmdNoneThe command to run.timeoutNoneThe timeout for the command.saveNoneSave the result to value.textTrueInterpret the in/output as text.shellTrueRun the program in a shell.program/bin/bashThe program to run the command with ('/bin/bash', '/bin/sh', '/bin/zsh').return_codeNoneThe expected return code of the command 'cmd'.Parameters for save:ParameterDefaultDescriptionnameNoneThe name for the variable to save the result in.typeNoneThe type for how to treat the result (STRING, JSON).Selenium (test_tool_selenium_plugin)Start a webbrowser and run tests viaselenium.Call:-type:SELENIUMcall:actions:[]base_url:'${GUI_BASE_URL}',path:'${GUI_PATH}',url:None,webdriver:['chrome']Object for action:action:Noneargs:Noneactions:Nonelog:NoneParameters:ParameterDefaultDescriptionactionsNoneThe actions to run on the website.base_url${REST_BASE_URL}The base url of the website to test.path${REST_PATH}The path of the website to test.urlNoneThe url value is built dynamically from ${base_url}/${path} if not set. Otherwiese the other values are ignored.webdriverTrueA list of webdrivers to test with [chrome, gecko, chromium-edge].Parameters for action:ParameterDefaultDescriptionactionNoneThe action to run on the driver/element.argsNoneThe arguments for the action.actionsNoneFollowup actions.logNoneA log to print if the action is started.SQL Plus (test_tool_sql_plus_plugin)Runs a sql file with sqlplus.Call:-type:SQL_PLUScall:file:Nonecommand:sqlplusconnection:${DB_CONNECTION}username:${DB_USERNAME}password:${DB_PASSWORD}Parameters:ParameterDefaultDescriptionfileNoneThe file to execute.commanesqlplusThe command to execute.connection${DB_CONNECTION}The connection string to the database.username${DB_USERNAME}The username of the database.password${DB_PASSWORD}The password of the database.SSH Cmd (test_tool_ssh_cmd_plugin)Runs a command on a remote machine via ssh.Call:-type:SSH_CMDcall:user:${REMOTE_CMD_USER}password:${REMOTE_CMD_PASSWORD}host:${REMOTE_CMD_HOST}cmd:Nonereturn_code:0Parameters:ParameterDefaultDescriptionuser${REMOTE_CMD_USER}The user for the ssh connection.password${REMOTE_CMD_PASSWORD}The password for the ssh connection.host${REMOTE_CMD_HOST}The host for the ssh connection.cmdNoneThe command to run.return_codeNoneThe expected return code of the command 'cmd'.Other available plugins:This project can handle any other plugins as well. There just need to be a installed module following a naming convention.
E.g. if you define a test in the calls.yaml like:-type:EXAMPLE_CALLcall:value1:Loremvalue2:IpsumThis tool then searches for a plugin called test_tool_example_name_plugin with the following required methods:# The default values of the plugindefault_example_name_call:Dict[str,Any]={'key1':'value1','key2':'value2'}# Change the values before the tests are rundefaugment_example_name_call(call:Dict[str,Any],data:Dict[str,Any],path:Path)->None:# Do your stuff here# call is a merged object from default_example_name_call and the object from the calls.yaml file.# data is the data from the data.yaml file modified in test steps.# The path of the folder where the test is.pass# Make the calldefmake_example_name_call(call:Dict[str,Any],data:Dict[str,Any])->None:# Do your stuff here# call is a merged object from default_example_name_call and the object from the calls.yaml file.# data is the data from the data.yaml file modified in test steps.passIf this module is found it is used to process the test case. In an case of an error, there should be thrown anAssertionError.DevelopmentRead theCONTRIBUTING.mdfile.