Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os.path
- import sys
- import win32api
- # Create the search path to the APV if it doesn't exist
- APVPath = os.path.abspath(".") # path to the APV if tseq.py started
- APVPathAlternative = os.path.abspath(".//..") # path to the APV if TestEditor.py started directly
- if not sys.path.count(APVPath):
- sys.path.insert(0, APVPath)
- if not sys.path.count(APVPathAlternative):
- sys.path.insert(0, APVPathAlternative)
- import CTest
- import SQSTestParser
- import SQSINIFile
- import SQSFrameClass
- startDir = os.path.dirname(sys.argv[0])
- startDir = os.path.split(startDir)[0]
- if os.path.isdir(startDir) == 0:
- startDir = os.getcwd()
- # This function is copied from tseq.py (importing tseq.py doesn't work here)
- def addLogfiles(ResDesc, AdditionalLogfiles, res):
- if len(AdditionalLogfiles) > 0:
- for al in AdditionalLogfiles:
- # take the result given with the Logfile
- if al[2] > res:
- res = al[2]
- testName = None
- stepId = None
- if len(al) > 3:
- testName = al[3]
- stepId = int(al[4])
- ResDesc.AddTestResultFile(al[0],al[1],al[2], testName=testName, stepId=stepId)
- return res
- m_cTest = CTest.CTest()
- try:
- import pythoncom
- #pythoncom.CoInitialize()
- # open the ini file from the commanline parameter
- inifile = SQSINIFile.SQSINIFile(sys.argv[1])
- inifile = inifile.ReadINIFile()
- # Set info to execute test
- m_cTest.m_errfilename = inifile.sections["DebugParameters"].data["m_errfilename"]
- m_cTest.m_version = inifile.sections["DebugParameters"].data["m_version"]
- m_cTest.m_date = inifile.sections["DebugParameters"].data["m_date"]
- m_cTest.m_Name = inifile.sections["DebugParameters"].data["m_Name"]
- m_cTest.m_author = inifile.sections["DebugParameters"].data["m_author"]
- m_cTest.m_testGroup = inifile.sections["DebugParameters"].data["m_testGroup"]
- m_cTest.m_File = inifile.sections["DebugParameters"].data["m_File"]
- m_cTest.m_Dir = inifile.sections["DebugParameters"].data["m_Dir"]
- StepByStep = inifile.sections["DebugParameters"].data["StepByStep"].lower() == "true"
- m_cTest.newLogfile()
- SQSTestParser.SQSTestParser(m_cTest, os.path.join(m_cTest.m_Dir, m_cTest.m_File), debugMode=True, StepByStep=StepByStep)
- m_cTest.m_ErrLog.result(m_cTest.m_Name)
- # Add additional logfiles and images to the temporary result folder
- TestDesc = SQSFrameClass.CTestDoc()
- ResDesc = SQSFrameClass.CResultDoc(TestDesc)
- ResDesc.ReadProfileFile(startDir+"\\tseq.ini")
- ResDesc.m_TestSeqNum = 0
- ResDesc.m_TmpBasePath = os.path.join(win32api.GetTempPath(), m_cTest.m_tTmpSubDir)
- ResDesc.m_PathToTestSeq = [m_cTest.m_testGroup]
- ResDesc.m_PathToResData = [[]]
- ResDesc.m_filesChkInPath = [[]]
- ResDesc.m_ResultOfResData = [[]]
- ResDesc.m_DescriptionOfResData = [[]]
- addLogfiles(ResDesc, m_cTest.m_AdditionalLogfiles, 0)
- pythoncom.CoUninitialize()
- except:
- import traceback
- traceback.print_exc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement