예제 #1
0
    def run_tests(self):
        """ Start the execution of the tests. """
        manifest = manifestparser.TestManifest(
            manifests=[os.path.join(self.repository.path, self.manifest_path)],
            strict=False)

        tests = manifest.active_tests(**mozinfo.info)

        # instantiate handlers
        logger = mozmill.logger.LoggerListener(log_file=self.options.logfile,
                                               console_level=self.debug and 'DEBUG' or 'INFO',
                                               file_level=self.debug and 'DEBUG' or 'INFO',
                                               debug=self.debug)
        handlers = [logger]
        if self.options.report_url:
            self.report = reports.DashboardReport(self.options.report_url, self)
            handlers.append(self.report)

        if self.options.junit_file:
            filename = files.get_unique_filename(self.options.junit_file,
                                                 self.testrun_index)
            self.junit_report = reports.JUnitReport(filename, self)
            handlers.append(self.junit_report)

        # instantiate MozMill
        profile_path = os.path.join(self.workspace, 'profile')
        self.mozlogger.info('Creating profile: %s' % profile_path)

        profile_args = dict(profile=profile_path,
                            addons=self.addon_list,
                            preferences=self.preferences,
                            )
        mozmill_args = dict(app=self.options.application,
                            binary=self._application,
                            handlers=handlers,
                            profile_args=profile_args,
                            )
        if self.timeout:
            mozmill_args['jsbridge_timeout'] = self.timeout
        self._mozmill = mozmill.MozMill.create(**mozmill_args)

        self.graphics = None

        for listener in self.listeners:
            self._mozmill.add_listener(listener[0], eventType=listener[1])

        self._mozmill.persisted.update(self.persisted)
        try:
            self._mozmill.run(tests, self.options.restart)
        finally:
            self.results = self._mozmill.finish()

            self.mozlogger.info('Removing profile: %s' % profile_path)
            mozfile.remove(profile_path)

        # Whenever a test fails it has to be marked, so we quit with the correct exit code
        self.last_failed_tests = self.last_failed_tests or self.results.fails

        self.testrun_index += 1
예제 #2
0
    def run_tests(self):
        """ Start the execution of the tests. """
        manifest = manifestparser.TestManifest(
            manifests=[os.path.join(self.repository_path, self.manifest_path)], strict=False
        )

        tests = manifest.active_tests(**mozinfo.info)

        # instantiate handlers
        logger = mozmill.logger.LoggerListener(
            log_file=self.options.logfile,
            console_level=self.debug and "DEBUG" or "INFO",
            file_level=self.debug and "DEBUG" or "INFO",
            debug=self.debug,
        )
        handlers = [logger]
        if self.options.report_url:
            self.report = reports.DashboardReport(self.options.report_url, self)
            handlers.append(self.report)

        if self.options.junit_file:
            filename = files.get_unique_filename(self.options.junit_file, self.testrun_index)
            self.junit_report = reports.JUnitReport(filename, self)
            handlers.append(self.junit_report)

        # instantiate MozMill
        profile_args = dict(addons=self.addon_list)
        runner_args = dict(binary=self._application)
        mozmill_args = dict(
            app=self.options.application, handlers=handlers, profile_args=profile_args, runner_args=runner_args
        )
        if self.timeout:
            mozmill_args["jsbridge_timeout"] = self.timeout
        self._mozmill = mozmill.MozMill.create(**mozmill_args)

        self.graphics = None

        for listener in self.listeners:
            self._mozmill.add_listener(listener[0], eventType=listener[1])

        self._mozmill.persisted.update(self.persisted)
        self._mozmill.run(tests, self.options.restart)

        self.results = self._mozmill.finish()

        # Whenever a test fails it has to be marked, so we quit with the correct exit code
        self.last_failed_tests = self.last_failed_tests or self.results.fails

        self.testrun_index += 1
예제 #3
0
 def _generate_custom_report(self):
     if self.options.junit_file:
         filename = files.get_unique_filename(self.options.junit_file,
                                              self.testrun_index)
         custom_report = self.update_report(self._mozmill.mozmill.get_report())
         report.JUnitReport(custom_report, filename)
예제 #4
0
            self._repository.update(branch_name)

            # instantiate handlers
            logger = mozmill.logger.LoggerListener(
                log_file=self.options.logfile,
                console_level=self.debug and "DEBUG" or "INFO",
                file_level=self.debug and "DEBUG" or "INFO",
                debug=self.debug,
            )
            handlers = [logger]
            if self.options.report_url:
                self.report = reports.DashboardReport(self.options.report_url, self)
                handlers.append(self.report)

            if self.options.junit_file:
                filename = files.get_unique_filename(self.options.junit_file, self.testrun_index)
                self.junit_report = reports.JUnitReport(filename, self)
                handlers.append(self.junit_report)

            # instantiate MozMill
            profile_args = dict(addons=self.addon_list)
            runner_args = dict(binary=self._application)
            mozmill_args = dict(
                app=self.options.application, handlers=handlers, profile_args=profile_args, runner_args=runner_args
            )
            if self.timeout:
                mozmill_args["jsbridge_timeout"] = self.timeout
            self._mozmill = mozmill.MozMill.create(**mozmill_args)

            self.graphics = None
            self._mozmill.add_listener(self.graphics_event, eventType="mozmill.graphics")