Ejemplo n.º 1
0
    def run(cls, className):
        """ Launch an application through reflection """

        cls.logger.info("is attempting to run [%s] wd=%s" %
                        (className, osLib.getcwd()))

        for appCls in Application.__subclasses__():
            if className == appCls.__name__:

                os = Env.getOS()
                osVersion = Env.getOSVersion(fullName=True)
                arch = java.lang.System.getProperty('os.arch')

                app = appCls()  # get an instance of this class
                binary = app.getBinary(
                    os, osVersion,
                    arch)  # get the binary to run from the instance
                cls.logger.info('created [%s] from [%s] [%s %s %s]' %
                                (className, binary, os, osVersion, arch))

                result = subprocess.Popen(binary,
                                          shell=True,
                                          cwd=app.getWorkingDir(
                                              os, osVersion, arch))

                return app

        raise Exception(
            "Unable to find Application sub-class [%s], ensure that it is included"
            % className)
Ejemplo n.º 2
0
 def assertThat(self, text):        
     self.validate()
     self.logger.info("Asserting [%s]" % text)
     
     baselinePath = self.config.imageBaseline + "/assert/" +  str(Env.getOS()).lower() + "/" + text + ".png"
     baseline = Pattern(baselinePath)
     
     # TODO: Refactor to allow for using RegionFinder class so PNG attributes can be used
     try:
         ImageLocator().locate( baselinePath )            
         result = self.region.find(baseline)                    
         self.logger.info('%%s matched %%s', self.logger.getFormatter()(result), self.logger.getFormatter()(baseline))
     except FindFailed, e:            
         self.logger.error('%%s does not match %%s', self.logger.getFormatter()(self.region), self.logger.getFormatter()(baseline))
         raise Exception("Assertion failure")        
Ejemplo n.º 3
0
    def run(cls, className):
        """ Launch an application through reflection """

        cls.logger.info("is attempting to run [%s] wd=%s" % (className, osLib.getcwd()))

        for appCls in Application.__subclasses__():
            if className == appCls.__name__:

                os = Env.getOS()
                osVersion = Env.getOSVersion(fullName=True)
                arch = java.lang.System.getProperty("os.arch")

                app = appCls()  # get an instance of this class
                binary = app.getBinary(os, osVersion, arch)  # get the binary to run from the instance
                cls.logger.info("created [%s] from [%s] [%s %s %s]" % (className, binary, os, osVersion, arch))

                result = subprocess.Popen(binary, shell=True, cwd=app.getWorkingDir(os, osVersion, arch))

                return app

        raise Exception("Unable to find Application sub-class [%s], ensure that it is included" % className)