def save_application_output(self, application, testClassName, testRunName, nr=None): """" saves the output of an application to a file This method can only be called if application was stopped before. If multiple instances of one application are started on one target the nr parameter can be used to generate unique filenames """ if not application.started: resultDirForTest = self.resultDir + '/' + testClassName + "/" + testRunName if nr is None: fileName = "{0}_{1}".format(application.name, self.name) else: fileName = "{0}{1}_{2}".format(application.name, nr, self.name) stdoutOutputList = application.get_stdout_data() if stdoutOutputList: helper.save_text_file( resultDirForTest + "/" + fileName + ".txt", "".join(stdoutOutputList)) stderrOutputList = application.get_stderr_data() if stderrOutputList: helper.save_text_file( resultDirForTest + "/" + fileName + "_STDERR.txt", "".join(stderrOutputList)) else: log.error( "application output can only be saved if application was stopped before" )
def save_application_output(self, application, testClassName, testRunName): """" saves the output of an application to a file This method can only be called if application was stopped before. """ if not application.started: resultDirForTest = self.resultDir + '/' + testClassName + "/" + testRunName if application.nameExtension: fileName = "{0}_{1}_{2}".format(application.name, application.nameExtension, self.name) else: fileName = "{0}_{1}".format(application.name, self.name) stdoutOutputList = application.get_stdout_data() if stdoutOutputList: helper.save_text_file( resultDirForTest + "/" + fileName + ".txt", "".join(stdoutOutputList)) stderrOutputList = application.get_stderr_data() if stderrOutputList: helper.save_text_file( resultDirForTest + "/" + fileName + "_STDERR.txt", "".join(stderrOutputList)) else: log.error( "application output can only be saved if application was stopped before" )