示例#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))
     builder = TestSuiteBuilder(settings['SuiteNames'],
                                extension=settings.extension,
                                rpa=settings.rpa,
                                allow_empty_suite=settings.run_empty_suite)
     suite = builder.build(*datasources)
     settings.rpa = suite.rpa
     if settings.pre_run_modifiers:
         suite.visit(ModelModifier(settings.pre_run_modifiers,
                                   settings.run_empty_suite, LOGGER))
     suite.configure(**settings.suite_config)
     with pyloggingconf.robot_handler_enabled(settings.log_level):
         old_max_error_lines = text.MAX_ERROR_LINES
         text.MAX_ERROR_LINES = settings.max_error_lines
         try:
             result = suite.run(settings)
         finally:
             text.MAX_ERROR_LINES = old_max_error_lines
         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
 def main(self, datasources, **options):
     settings = RobotSettings(options)
     LOGGER.register_console_logger(**settings.console_output_config)
     if settings['Critical'] or settings['NonCritical']:
         LOGGER.warn("Command line options --critical and --noncritical have been "
                     "deprecated. Use --skiponfailure instead.")
     if settings['XUnitSkipNonCritical']:
         LOGGER.warn("Command line option --xunitskipnoncritical has been "
                     "deprecated and has no effect.")
     LOGGER.info('Settings:\n%s' % unic(settings))
     builder = TestSuiteBuilder(settings['SuiteNames'],
                                included_extensions=settings.extension,
                                rpa=settings.rpa,
                                allow_empty_suite=settings.run_empty_suite)
     suite = builder.build(*datasources)
     settings.rpa = suite.rpa
     if settings.pre_run_modifiers:
         suite.visit(ModelModifier(settings.pre_run_modifiers,
                                   settings.run_empty_suite, LOGGER))
     suite.configure(**settings.suite_config)
     with pyloggingconf.robot_handler_enabled(settings.log_level):
         old_max_error_lines = text.MAX_ERROR_LINES
         text.MAX_ERROR_LINES = settings.max_error_lines
         try:
             result = suite.run(settings)
         finally:
             text.MAX_ERROR_LINES = old_max_error_lines
         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
 def main(self, datasources, **options):
     settings = RobotSettings(options)
     LOGGER.register_console_logger(**settings.console_output_config)
     LOGGER.info('Settings:\n%s' % unic(settings))
     if settings['WarnOnSkipped'] is not None:
         LOGGER.error("Option '--warnonskippedfiles is deprecated and "
                      "has no effect.")
     builder = TestSuiteBuilder(settings['SuiteNames'],
                                extension=settings.extension,
                                rpa=settings.rpa)
     suite = builder.build(*datasources)
     settings.rpa = builder.rpa
     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
示例#4
0
 def result(self):
     if self._result is None:
         include_keywords = bool(self._settings.log or self._settings.output)
         flattened = self._settings.flatten_keywords
         self._result = ExecutionResult(include_keywords=include_keywords,
                                        flattened_keywords=flattened,
                                        merge=self._settings.merge,
                                        *self._sources)
         self._result.configure(self._settings.status_rc,
                                self._settings.suite_config,
                                self._settings.statistics_config)
         modifier = ModelModifier(self._settings.pre_rebot_modifiers,
                                  self._settings.process_empty_suite,
                                  LOGGER)
         self._result.suite.visit(modifier)
         self.return_code = self._result.return_code
     return self._result
示例#5
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
示例#6
0
 def main(self, datasources, **options):
     try:
         settings = RobotSettings(options)
     except:
         LOGGER.register_console_logger(stdout=options.get('stdout'),
                                        stderr=options.get('stderr'))
         raise
     LOGGER.register_console_logger(**settings.console_output_config)
     LOGGER.info(f'Settings:\n{settings}')
     if settings.pythonpath:
         sys.path = settings.pythonpath + sys.path
     builder = TestSuiteBuilder(settings.suite_names,
                                included_extensions=settings.extension,
                                rpa=settings.rpa,
                                lang=settings.languages,
                                allow_empty_suite=settings.run_empty_suite)
     suite = builder.build(*datasources)
     settings.rpa = suite.rpa
     if settings.pre_run_modifiers:
         suite.visit(
             ModelModifier(settings.pre_run_modifiers,
                           settings.run_empty_suite, LOGGER))
     suite.configure(**settings.suite_config)
     with pyloggingconf.robot_handler_enabled(settings.log_level):
         old_max_error_lines = text.MAX_ERROR_LINES
         old_max_assign_length = text.MAX_ASSIGN_LENGTH
         text.MAX_ERROR_LINES = settings.max_error_lines
         text.MAX_ASSIGN_LENGTH = settings.max_assign_length
         try:
             result = suite.run(settings)
         finally:
             text.MAX_ERROR_LINES = old_max_error_lines
             text.MAX_ASSIGN_LENGTH = old_max_assign_length
         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