def getDummyLog(self, testLogDir, autName, browserList, buildError): self.log.info("Generating dummy log file for %s" %autName) dummyLogFile = os.path.join(testLogDir, autName, "DUMMY_%s.log" %(autName + self.startDate)) dummyLog = codecs.open(dummyLogFile, "w", "utf-8") for browser in browserList: prefix = "qxSimulator_%s: " %str(random.randint(100000, 999999)) dummyLog.write(prefix + "<h1>%s results from %s</h1>\n" %(autName, self.startDate)) platform = util.getOperatingSystemName() if platform == "Windows": platform = "Win32" dummyLog.write(prefix + "<p>Platform: %s</p>\n" %platform) dummyLog.write(prefix + "<p>User agent: %s</p>\n" %browser) dummyLog.write(prefix + "<div class=\"qxappender\"><div class=\"level-error\">BUILD ERROR: %s</div></div>\n" %buildError) dummyLog.close() self.log.info("Created dummy log file %s" %dummyLogFile) return dummyLogFile
def kill(self): if self.simulate: self.log.info("SIMULATION: Killing all running Selenium server processes.") return else: self.log.info("Killing all running Selenium server processes.") os = util.getOperatingSystemName() if os == "Linux": util.invokeExternal("pkill -f selenium-server") return if os == "Mac OS X": util.invokeExternal("pkill selenium-server") else: if "killSelenium" in self.configuration: util.invokeExternal(self.configuration['killSelenium']) else: self.log.error("No kill command known for this OS")
def kill(self): if self.simulate: self.log.info( "SIMULATION: Killing all running Selenium server processes." ) return else: self.log.info("Killing all running Selenium server processes.") os = util.getOperatingSystemName() if os == "Linux": util.invokeExternal("pkill -f selenium-server") return if os == "Mac OS X": util.invokeExternal("pkill selenium-server") else: if "killSelenium" in self.configuration: util.invokeExternal(self.configuration['killSelenium']) else: self.log.error("No kill command known for this OS")
def getStartCmd(self): conf = self.configuration cmd = conf["javaBin"] if "rhinoJar" in conf: cmd += " -cp %s%s%s" % (conf["seleniumClientDriverJar"], conf["classPathSeparator"], conf["rhinoJar"]) if "rhinoMainClass" in conf: cmd += " %s" % conf["rhinoMainClass"] else: cmd += " org.mozilla.javascript.tools.shell.Main" cmd += " %s" % conf["simulationScript"] cmd += " autHost=%s" % conf["autHost"] cmd += " autPath=" # Encode any URL parameters autPathList = conf['autPath'].split("?") if len(autPathList) == 1: cmd += autPathList[0] else: cmd += autPathList[0] + "%3F" + urllib.quote(autPathList[1]) cmd += " simulatorSvn=%s" % conf['simulatorSvn'] if (util.getOperatingSystemName() == "Windows"): cmd += " testBrowser=%s" % conf["browserLauncher"] else: cmd += " testBrowser='%s'" % conf["browserLauncher"] cmd += " browserId=\"%s\"" % conf["browserId"] if conf["simulationOptions"]: for opt in conf["simulationOptions"]: cmd += ' "%s"' % opt if "testLogFile" in conf: cmd += " logFile=%s" % conf["testLogFile"] return cmd
def getStartCmd(self): conf = self.configuration cmd = conf["javaBin"] if "rhinoJar" in conf: cmd += " -cp %s%s%s" %(conf["seleniumClientDriverJar"], conf["classPathSeparator"], conf["rhinoJar"]) if "rhinoMainClass" in conf: cmd += " %s" %conf["rhinoMainClass"] else: cmd += " org.mozilla.javascript.tools.shell.Main" cmd += " %s" %conf["simulationScript"] cmd += " autHost=%s" %conf["autHost"] cmd += " autPath=" # Encode any URL parameters autPathList = conf['autPath'].split("?") if len(autPathList) == 1: cmd += autPathList[0] else: cmd += autPathList[0] + "%3F" + urllib.quote(autPathList[1]) cmd += " simulatorSvn=%s" %conf['simulatorSvn'] if (util.getOperatingSystemName() == "Windows"): cmd += " testBrowser=%s" %conf["browserLauncher"] else: cmd += " testBrowser='%s'" %conf["browserLauncher"] cmd += " browserId=\"%s\"" %conf["browserId"] if conf["simulationOptions"]: for opt in conf["simulationOptions"]: cmd += ' "%s"' %opt if "testLogFile" in conf: cmd += " logFile=%s" %conf["testLogFile"] return cmd
def getDummyLog(self, testLogDir, autName, browserList, buildError): self.log.info("Generating dummy log file for %s" % autName) dummyLogFile = os.path.join( testLogDir, autName, "DUMMY_%s.log" % (autName + self.startDate)) dummyLog = codecs.open(dummyLogFile, "w", "utf-8") for browser in browserList: prefix = "qxSimulator_%s: " % str(random.randint(100000, 999999)) dummyLog.write(prefix + "<h1>%s results from %s</h1>\n" % (autName, self.startDate)) platform = util.getOperatingSystemName() if platform == "Windows": platform = "Win32" dummyLog.write(prefix + "<p>Platform: %s</p>\n" % platform) dummyLog.write(prefix + "<p>User agent: %s</p>\n" % browser) dummyLog.write( prefix + "<div class=\"qxappender\"><div class=\"level-error\">BUILD ERROR: %s</div></div>\n" % buildError) dummyLog.close() self.log.info("Created dummy log file %s" % dummyLogFile) return dummyLogFile
def getTestRunDict(self, config): autName = config["autName"] if "Source" in config["autName"]: autName = config["autName"][0:config["autName"].find("Source")] testRunDict = { "test_type" : config["runType"], "revision" : "", "aut_name" : autName, "aut_host" : config["autHost"], "aut_qxpath" : "", "aut_path" : config["autPath"], "test_host" : config["testHostName"], "test_hostos" : util.getOperatingSystemName(), "test_hostid" : "", "start_date" : config["startDate"], "end_date" : util.getTimestamp(), "simulations": [], "dev_run" : False } if config["autName"] in self.buildStatus: if "SVNRevision" in self.buildStatus[config["autName"]]: revision = self.buildStatus[config["autName"]]["SVNRevision"] testRunDict["revision"] = revision if "autQxPath" in config: testRunDict["aut_qxpath"] = config["autQxPath"] if "testHostId" in config: testRunDict["test_hostid"] = config["testHostId"] if "devRun" in config: testRunDict["dev_run"] = config["devRun"] return testRunDict
def getTestRunDict(self, config): autName = config["autName"] if "Source" in config["autName"]: autName = config["autName"][0:config["autName"].find("Source")] testRunDict = { "test_type": config["runType"], "revision": "", "aut_name": autName, "aut_host": config["autHost"], "aut_qxpath": "", "aut_path": config["autPath"], "test_host": config["testHostName"], "test_hostos": util.getOperatingSystemName(), "test_hostid": "", "start_date": config["startDate"], "end_date": util.getTimestamp(), "simulations": [], "dev_run": False } if config["autName"] in self.buildStatus: if "SVNRevision" in self.buildStatus[config["autName"]]: revision = self.buildStatus[config["autName"]]["SVNRevision"] testRunDict["revision"] = revision if "autQxPath" in config: testRunDict["aut_qxpath"] = config["autQxPath"] if "testHostId" in config: testRunDict["test_hostid"] = config["testHostId"] if "devRun" in config: testRunDict["dev_run"] = config["devRun"] return testRunDict