Esempio n. 1
0
 def runSimsForApp(self, app, appConf):
     testReportFile = self.prepareTestReport(self.getConfigSetting("base/reportDirectory", ""), app)
     logDirectory = self.getConfigSetting("base/logDirectory", False)
     if logDirectory:
         testLogFile = "%s/%s/%s.log" %(logDirectory,app,util.getTimestamp())
     
     seleniumConfig = self.getConfigSetting("selenium")        
     
     manageSeleniumServer = self.getConfigSetting("selenium/seleniumServerJar", False)
     individualServer = self.getConfigSetting("individualServer", True, appConf)
     if manageSeleniumServer and not individualServer:
         self.log.info("Using one Selenium server instance for all %s simulations." %app)            
         seleniumOptions = self.getConfigSetting("seleniumServerOptions", None, appConf)
         if seleniumOptions:
             seleniumConfig["options"] = seleniumOptions
         seleniumServer = SeleniumServer(seleniumConfig, logger=self.log)
         seleniumServer.start()
   
     if app in self.buildStatus:
         if self.buildStatus[app]["BuildError"]:
             self.sendDummyReport(app, appConf, testReportFile)            
             return
     
     self.log.info("Running simulations for %s" %app)
     for browser in appConf["browsers"]:
         if manageSeleniumServer and individualServer:
             seleniumServer = SeleniumServer(seleniumConfig, logger=self.log)
             seleniumServer.start()
         simConf = self.getSimulationConfig(app, "applications", browser)
         if testLogFile:
             simConf["testLogFile"] = testLogFile
         sim = Simulation(simConf, logger=self.log)
         sim.run()
         if manageSeleniumServer and individualServer:
             seleniumServer.stop()
     
     if manageSeleniumServer and not individualServer:
         seleniumServer = SeleniumServer(seleniumConfig, logger=self.log)
         seleniumServer.stop()
     
     if self.getConfigSetting("reporting/mailTo", False):
         self.formatLog(simConf["testLogFile"], testReportFile, None)
         self.sendReport(app, testReportFile, self.getConfigSetting("reporting"))
 
     reportServer = self.getConfigSetting("reporting/reportServer", False)
     if reportServer:
         reportConf = {
           "runType" : self.getConfigSetting("testRun/runType", ""),
           "autName" : app,
           "autHost" : self.getConfigSetting("testRun/host", ""),
           "autQxPath" : self.getConfigSetting("testRun/qxPath", ""),
           "autPath" : appConf["path"],
           "startDate" : self.startDate,
           "testHostName" : self.getConfigSetting("base/testHostName", ""),
           "testHostId" : self.getConfigSetting("base/testHostId", ""),
         }
         try:
           self.reportResults(reportServer, simConf["testLogFile"], reportConf, simConf["ignoreLogEntries"])
         except Exception, e:
           self.log.error("Error sending report: " + str(e))
Esempio n. 2
0
    def runSimsForCollection(self, collection, collConf, simulatorBaseDir):
        seleniumConfig = self.getConfigSetting("selenium")
        simulatorDirectory = os.path.join(simulatorBaseDir, "trunk", "tool", "selenium", "simulation", "demobrowser", "demo")
        #print "running simulations for demos: " + repr(collConf)
        
        #testReportFile = self.prepareTestReport(self.getConfigSetting("base/reportDirectory", ""), collection)
        
        scanDir = collConf["scanDir"]
        appList = util.locate(scanDir, "*.html")
        
        for appDir in appList:
            dir, file = os.path.split(appDir)
            category = os.path.basename(dir) 
            appName, ext = os.path.splitext(file)
            #print category + " - " + appName
            
            scriptFile = os.path.join(simulatorDirectory, category, appName + ".js")
            if os.path.isfile(scriptFile):
                #print "got a test script for " + category + "-" + appName

                self.log.info("Running simulations for %s" %category + "." + appName)
                
                for browser in collConf["browsers"]:
                    seleniumServer = SeleniumServer(seleniumConfig, logger = self.log)
                    seleniumServer.start()
                    simConf = self.getSimulationConfig(collection, "collections", browser)
                    simConf["autPath"] = appDir
                    simConf["simulationScript"] = scriptFile
                    #print repr(simConf)            
                    sim = Simulation(simConf)
                    sim.run()
                    seleniumServer.stop()
Esempio n. 3
0
    def runSimsForCollection(self, collection, collConf, simulatorBaseDir):
        seleniumConfig = self.getConfigSetting("selenium")
        simulatorDirectory = os.path.join(simulatorBaseDir, "trunk", "tool",
                                          "selenium", "simulation",
                                          "demobrowser", "demo")
        #print "running simulations for demos: " + repr(collConf)

        #testReportFile = self.prepareTestReport(self.getConfigSetting("base/reportDirectory", ""), collection)

        scanDir = collConf["scanDir"]
        appList = util.locate(scanDir, "*.html")

        for appDir in appList:
            dir, file = os.path.split(appDir)
            category = os.path.basename(dir)
            appName, ext = os.path.splitext(file)
            #print category + " - " + appName

            scriptFile = os.path.join(simulatorDirectory, category,
                                      appName + ".js")
            if os.path.isfile(scriptFile):
                #print "got a test script for " + category + "-" + appName

                self.log.info("Running simulations for %s" % category + "." +
                              appName)

                for browser in collConf["browsers"]:
                    seleniumServer = SeleniumServer(seleniumConfig,
                                                    logger=self.log)
                    seleniumServer.start()
                    simConf = self.getSimulationConfig(collection,
                                                       "collections", browser)
                    simConf["autPath"] = appDir
                    simConf["simulationScript"] = scriptFile
                    #print repr(simConf)
                    sim = Simulation(simConf)
                    sim.run()
                    seleniumServer.stop()
Esempio n. 4
0
    def runSimsForApp(self, app, appConf):
        testReportFile = self.prepareTestReport(
            self.getConfigSetting("base/reportDirectory", ""), app)
        logDirectory = self.getConfigSetting("base/logDirectory", False)
        if logDirectory:
            testLogFile = "%s/%s/%s.log" % (logDirectory, app,
                                            util.getTimestamp())

        seleniumConfig = self.getConfigSetting("selenium")

        manageSeleniumServer = self.getConfigSetting(
            "selenium/seleniumServerJar", False)
        individualServer = self.getConfigSetting("individualServer", True,
                                                 appConf)
        if manageSeleniumServer and not individualServer:
            self.log.info(
                "Using one Selenium server instance for all %s simulations." %
                app)
            seleniumOptions = self.getConfigSetting("seleniumServerOptions",
                                                    None, appConf)
            if seleniumOptions:
                seleniumConfig["options"] = seleniumOptions
            seleniumServer = SeleniumServer(seleniumConfig, logger=self.log)
            seleniumServer.start()

        if app in self.buildStatus:
            if self.buildStatus[app]["BuildError"]:
                self.sendDummyReport(app, appConf, testReportFile)
                return

        self.log.info("Running simulations for %s" % app)
        for browser in appConf["browsers"]:
            if manageSeleniumServer and individualServer:
                seleniumServer = SeleniumServer(seleniumConfig,
                                                logger=self.log)
                seleniumServer.start()
            simConf = self.getSimulationConfig(app, "applications", browser)
            if testLogFile:
                simConf["testLogFile"] = testLogFile
            sim = Simulation(simConf, logger=self.log)
            sim.run()
            if manageSeleniumServer and individualServer:
                seleniumServer.stop()

        if manageSeleniumServer and not individualServer:
            seleniumServer = SeleniumServer(seleniumConfig, logger=self.log)
            seleniumServer.stop()

        if self.getConfigSetting("reporting/mailTo", False):
            self.formatLog(simConf["testLogFile"], testReportFile, None)
            self.sendReport(app, testReportFile,
                            self.getConfigSetting("reporting"))

        reportServer = self.getConfigSetting("reporting/reportServer", False)
        if reportServer:
            reportConf = {
                "runType": self.getConfigSetting("testRun/runType", ""),
                "autName": app,
                "autHost": self.getConfigSetting("testRun/host", ""),
                "autQxPath": self.getConfigSetting("testRun/qxPath", ""),
                "autPath": appConf["path"],
                "startDate": self.startDate,
                "testHostName": self.getConfigSetting("base/testHostName", ""),
                "testHostId": self.getConfigSetting("base/testHostId", ""),
            }
            try:
                self.reportResults(reportServer, simConf["testLogFile"],
                                   reportConf, simConf["ignoreLogEntries"])
            except Exception, e:
                self.log.error("Error sending report: " + str(e))