I have a small test program with lib_procs.py
, main_test.py
and test_engine.py
. Right now main_test obj is instantiated in test_engine.py
. The obj is used to invoke the execute method in main_test.py. In the execute method procs.run_cmd(msg,cmd)
is called which sends the command and returns the message.
lib_procs.py
def run_cmd(msg, cmd):
#send hardware command and return something
#it has other hardware specific method too
main_test.py
import lib_procs as procs
class main_test(object):
def __init__(self, xmlpath, name)
#initialize
def execute(self):
#Currently
#parse xml
msg = xml.msg
cmd = xml.cmd
output = procs.run_cmd(cmd, msg)
#Do other things too
TestEngine.py
if __name__ == "__main__::
test_obj = main_test(xmlpath, test_name)
test_obj.execute()
What I want to do is be able to run the run_cmd but through XML file. The XML file should have the information on what function to invoke. This should be extracted in main_test.py
. The purpose of this is to make the test framework generic which could be used by others by changing the information in XML. Right now procs.run_cmd is hardware specific. Is it possible to do?