def executeScript(inputScript, scriptOptionalArgs, inputFile=None): global testcaseInfoList global testcaseInfo global yamlCont testcaseInfoList = [] yamlCont = {} if inputFile != None: fil = open(inputFile, "r") yamlCont = yaml.load(fil) # inputFileType = re.search('(.*).yaml', inputFile).group(1) inputFileType = 'unknown' if inputFile != None: inputFileType = re.search('(.*).yaml', inputFile).group(1) cmd = "%s %s" % (inputScript, ' '.join(scriptOptionalArgs)) #inputFileType = 'unknown' print "@@@@@@@@@@@@@@@" print cmd print "@@@@@@@@@@@@@@@" ps = winpexpect.winspawn(cmd) ps.logfile_read = sys.stdout ## Initialize testcaseInfo if the script is not a flist. if inputFileType in ['unknown']: scriptName = inputScript testcaseInfo = testInfo(scriptName) testcaseInfoList.append(testcaseInfo) timeout = -1 ps.interact(output_filter=scriptExecutionMonitor) if inputFileType is 'unknown': ## creates a nested suite suiteList = [] for testcaseInfo in testcaseInfoList: testcaseInfo.flush() suite = createRobotSuite(testcaseInfo) suiteList.append(suite) suite = TestSuite(inputScript) suite.suites = suiteList result = suite.run(output='output.xml', loglevel='debug') for testcaseInfo in testcaseInfoList: testcaseInfo.variableFile.close() else: ## creates a single suite for testcaseInfo in testcaseInfoList: testcaseInfo.flush() print testcaseInfo suite = createRobotSuite(testcaseInfo) result = suite.run(output='output.xml', loglevel='debug') testcaseInfo.variableFile.close() # Generating log files requires processing the earlier generated output XML. ResultWriter('output.xml').write_results() pp = postProcess.postProcess(suiteFile=testcaseInfo.scriptName) pp.close()
def executeScript(inputScript, scriptOptionalArgs, inputFile=None): global testcaseInfoList global testcaseInfo global yamlCont testcaseInfoList = [] yamlCont = {} if inputFile != None: fil = open(inputFile, "r") yamlCont = yaml.load(fil) # inputFileType = re.search('(.*).yaml', inputFile).group(1) inputFileType = 'unknown' if inputFile != None: inputFileType = re.search('(.*).yaml', inputFile).group(1) cmd = "%s %s" %(inputScript, ' '.join(scriptOptionalArgs)) #inputFileType = 'unknown' print "@@@@@@@@@@@@@@@" print cmd print "@@@@@@@@@@@@@@@" ps = winpexpect.winspawn(cmd) ps.logfile_read = sys.stdout ## Initialize testcaseInfo if the script is not a flist. if inputFileType in ['unknown']: scriptName = inputScript testcaseInfo = testInfo(scriptName) testcaseInfoList.append(testcaseInfo) timeout = -1 ps.interact(output_filter=scriptExecutionMonitor) if inputFileType is 'unknown': ## creates a nested suite suiteList = [] for testcaseInfo in testcaseInfoList: testcaseInfo.flush() suite = createRobotSuite(testcaseInfo) suiteList.append(suite) suite = TestSuite(inputScript) suite.suites = suiteList result = suite.run(output='output.xml', loglevel='debug') for testcaseInfo in testcaseInfoList: testcaseInfo.variableFile.close() else: ## creates a single suite for testcaseInfo in testcaseInfoList: testcaseInfo.flush() print testcaseInfo suite = createRobotSuite(testcaseInfo) result = suite.run(output='output.xml', loglevel='debug') testcaseInfo.variableFile.close() # Generating log files requires processing the earlier generated output XML. ResultWriter('output.xml').write_results() pp = postProcess.postProcess(suiteFile=testcaseInfo.scriptName) pp.close()
def main(self, datasources, **options): STOP_SIGNAL_MONITOR.start() settings = RobotSettings(options) pyloggingconf.initialize(settings['LogLevel']) LOGGER.register_console_logger(width=settings['MonitorWidth'], colors=settings['MonitorColors'], stdout=settings['StdOut'], stderr=settings['StdErr']) init_global_variables(settings) suite = TestSuite(datasources, settings) output = Output(settings) suite.run(output) LOGGER.info("Tests execution ended. Statistics:\n%s" % suite.get_stat_message()) output.close(suite) if settings.is_rebot_needed(): output, settings = settings.get_rebot_datasource_and_settings() ResultWriter(output).write_results(settings) return suite.return_code
def main(self, datasources, **options): STOP_SIGNAL_MONITOR.start() namespace.IMPORTER.reset() settings = RobotSettings(options) pyloggingconf.initialize(settings['LogLevel']) LOGGER.register_console_logger(width=settings['MonitorWidth'], colors=settings['MonitorColors'], stdout=settings['StdOut'], stderr=settings['StdErr']) init_global_variables(settings) suite = TestSuite(datasources, settings) output = Output(settings) suite.run(output) LOGGER.info("Tests execution ended. Statistics:\n%s" % suite.get_stat_message()) output.close(suite) if settings.is_rebot_needed(): output, settings = settings.get_rebot_datasource_and_settings() ResultWriter(output).write_results(settings) return suite.return_code
def executeScript(inputScript, scriptOptionalArgs, inputFile=None): global testcaseInfoList global testcaseInfo global yamlCont testcaseInfoList = [] yamlCont = {} if inputFile != None: fil = open(inputFile, "r") yamlCont = yaml.load(fil) # inputFileType = re.search('(.*).yaml', inputFile).group(1) if re.search("\.log\.", inputScript): cmd = ( "python /work/swtest01_1/sgsubramaniam/sw-test/special_script/demoScript/slowcat.py -d 0.002 %s" % inputScript ) else: cmd = "f10tool %s %s" % (inputScript, " ".join(scriptOptionalArgs)) if re.search("\.flist$", inputScript): inputFileType = "flist" cmd = "f10tool %s %s" % (inputScript, " ".join(scriptOptionalArgs)) elif re.search("\.f10$", inputScript): inputFileType = "f10" cmd = "f10tool %s %s" % (inputScript, " ".join(scriptOptionalArgs)) else: inputFileType = "unknown" if inputFile != None: inputFileType = re.search("(.*).yaml", inputFile).group(1) cmd = "%s %s;echo '----------'" % (inputScript, " ".join(scriptOptionalArgs)) ps = winpexpect.winspawn(cmd) ps.logfile_read = sys.stdout ## Initialize testcaseInfo if the script is not a flist. if inputFileType in ["f10", "unknown"]: scriptName = inputScript testcaseInfo = testInfo(scriptName) testcaseInfoList.append(testcaseInfo) timeout = -1 ps.interact(output_filter=scriptExecutionMonitor) if inputFileType is "flist" or "rspec": ## creates a nested suite suiteList = [] for testcaseInfo in testcaseInfoList: testcaseInfo.flush() suite = createRobotSuite(testcaseInfo) suiteList.append(suite) suite = TestSuite(inputScript) suite.suites = suiteList result = suite.run(output="output.xml", loglevel="debug") for testcaseInfo in testcaseInfoList: testcaseInfo.variableFile.close() else: ## creates a single suite for testcaseInfo in testcaseInfoList: testcaseInfo.flush() print testcaseInfo suite = createRobotSuite(testcaseInfo) result = suite.run(output="output.xml", loglevel="debug") testcaseInfo.variableFile.close() # Generating log files requires processing the earlier generated output XML. ResultWriter("output.xml").write_results() pp = postProcess.postProcess(suiteFile=testcaseInfo.scriptName) pp.close()
def executeScript(inputScript, scriptOptionalArgs, inputFile=None): global testcaseInfoList global testcaseInfo global yamlCont testcaseInfoList = [] yamlCont = {} if inputFile != None: fil = open(inputFile, "r") yamlCont = yaml.load(fil) # inputFileType = re.search('(.*).yaml', inputFile).group(1) if re.search("\.log\.", inputScript): cmd = "python /work/swtest01_1/sgsubramaniam/sw-test/special_script/demoScript/slowcat.py -d 0.002 %s" %inputScript else: cmd = "f10tool %s %s" %(inputScript, ' '.join(scriptOptionalArgs)) if re.search("\.flist$", inputScript): inputFileType = 'flist' cmd = "f10tool %s %s" %(inputScript, ' '.join(scriptOptionalArgs)) elif re.search("\.f10$", inputScript): inputFileType = 'f10' cmd = "f10tool %s %s" %(inputScript, ' '.join(scriptOptionalArgs)) else: inputFileType = 'unknown' if inputFile != None: inputFileType = re.search('(.*).yaml', inputFile).group(1) cmd = "%s %s;echo '----------'" %(inputScript, ' '.join(scriptOptionalArgs)) ps = winpexpect.winspawn(cmd) ps.logfile_read = sys.stdout ## Initialize testcaseInfo if the script is not a flist. if inputFileType in ['f10', 'unknown']: scriptName = inputScript testcaseInfo = testInfo(scriptName) testcaseInfoList.append(testcaseInfo) timeout = -1 ps.interact(output_filter=scriptExecutionMonitor) if inputFileType is 'flist' or 'rspec': ## creates a nested suite suiteList = [] for testcaseInfo in testcaseInfoList: testcaseInfo.flush() suite = createRobotSuite(testcaseInfo) suiteList.append(suite) suite = TestSuite(inputScript) suite.suites = suiteList result = suite.run(output='output.xml', loglevel='debug') for testcaseInfo in testcaseInfoList: testcaseInfo.variableFile.close() else: ## creates a single suite for testcaseInfo in testcaseInfoList: testcaseInfo.flush() print testcaseInfo suite = createRobotSuite(testcaseInfo) result = suite.run(output='output.xml', loglevel='debug') testcaseInfo.variableFile.close() # Generating log files requires processing the earlier generated output XML. ResultWriter('output.xml').write_results() pp = postProcess.postProcess(suiteFile=testcaseInfo.scriptName) pp.close()