示例#1
0
 def main(self, datasources, **options):
     settings = RobotSettings(options)
     LOGGER.register_console_logger(**settings.console_output_config)
     LOGGER.info("Settings:\n%s" % unic(settings))
     suite = TestSuiteBuilder(settings["SuiteNames"], settings["WarnOnSkipped"]).build(*datasources)
     suite.configure(**settings.suite_config)
     if settings.pre_run_modifiers:
         suite.visit(ModelModifier(settings.pre_run_modifiers, settings.run_empty_suite, LOGGER))
     with pyloggingconf.robot_handler_enabled(settings.log_level):
         result = suite.run(settings)
         LOGGER.info("Tests execution ended. Statistics:\n%s" % result.suite.stat_message)
         if settings.log or settings.report or settings.xunit:
             writer = ResultWriter(settings.output if settings.log else result)
             writer.write_results(settings.get_rebot_settings())
     return result.return_code
示例#2
0
 def main(self, datasources, **options):
     settings = RobotSettings(options)
     LOGGER.register_console_logger(**settings.console_output_config)
     LOGGER.info('Settings:\n%s' % unicode(settings))
     suite = TestSuiteBuilder(settings['SuiteNames'],
                              settings['WarnOnSkipped']).build(*datasources)
     suite.configure(**settings.suite_config)
     if settings.pre_run_modifiers:
         suite.visit(ModelModifier(settings.pre_run_modifiers,
                                   settings.run_empty_suite, LOGGER))
     with pyloggingconf.robot_handler_enabled(settings.log_level):
         result = suite.run(settings)
         LOGGER.info("Tests execution ended. Statistics:\n%s"
                     % result.suite.stat_message)
         if settings.log or settings.report or settings.xunit:
             writer = ResultWriter(settings.output if settings.log
                                   else result)
             writer.write_results(settings.get_rebot_settings())
     return result.return_code
示例#3
0
class RobotFramework(Application):
    def __init__(self):
        self.logger1 = new_logger_for_thread()
        Application.__init__(self,
                             USAGE,
                             arg_limits=(1, ),
                             env_options='ROBOT_OPTIONS',
                             logger=self.logger1)
        self.settings = None
        self.suite = None

    def main(self, datasources, **options):
        self.settings = RobotSettings(options)
        self.logger1.register_console_logger(
            **self.settings.console_output_config)
        self.logger1.info('Settings:\n%s' % unic(self.settings))
        self.suite = TestSuiteBuilder(
            self.settings['SuiteNames'],
            self.settings['WarnOnSkipped']).build(*datasources)
        self.suite.configure(**self.settings.suite_config)
        if self.settings.pre_run_modifiers:
            self.suite.visit(
                ModelModifier(self.settings.pre_run_modifiers,
                              self.settings.run_empty_suite, self.logger1))
        with pyloggingconf.robot_handler_enabled(self.settings.log_level):
            result = self.suite.run(self.settings)
            self.logger1.info("Tests execution ended. Statistics:\n%s" %
                              result.suite.stat_message)
            if self.settings.log or self.settings.report or self.settings.xunit:
                writer = ResultWriter(
                    self.settings.output if self.settings.log else result)
                writer.write_results(self.settings.get_rebot_settings())
        return result.return_code

    def validate(self, options, arguments):
        return self._filter_options_without_value(options), arguments

    def _filter_options_without_value(self, options):
        return dict((name, value) for name, value in options.items()
                    if value not in (None, []))