def configure_ioc(self, tests_dir, actions_dir, custom_actions_dir, pages_dir, languages_dir, report_file_dir, file_pattern, scenarios_to_run, report_file_name, culture, base_url, lang, browser_to_run, browser_driver, write_report, extra_args): config = InPlaceConfig() config.register_instance("extra_args", extra_args) config.register("browser_driver", self.__select_browser_driver(lang, browser_driver)) config.register_instance("language", lang) if (file_pattern == "to_be_defined_by_language"): file_pattern = lang["default_pattern"] config.register("file_pattern", file_pattern) config.register("scenarios_to_run", scenarios_to_run) config.register("write_report", write_report) config.register("report_file_dir", report_file_dir) config.register("report_file_name", report_file_name) config.register("test_fixture_parser", FileTestFixtureParser) config.register("tests_dir", tests_dir) config.register_files("all_actions", actions_dir, "*_action.py", lifestyle_type = "singleton") config.register_inheritors("all_pages", pages_dir, Page) config.register_inheritors("all_custom_actions", custom_actions_dir, ActionBase) config.register("story_runner", StoryRunner) config.register("browser_to_run", "*%s" % browser_to_run) config.register("scripts_path", abspath(dirname(__file__))) config.register("base_url", base_url) IoC.configure(config)
def configure_context( self, tests_dir, actions_dir, custom_actions_dir, pages_dir, languages_dir, report_file_dir, file_pattern, report_file_name, default_culture, base_url, should_throw, write_report, browser_to_run, browser_driver, context, ): IoC.reset() if not languages_dir: languages_dir = abspath(join(dirname(__file__), "languages")) if not actions_dir: actions_dir = abspath(join(dirname(__file__), "actions")) if not pages_dir: pages_dir = tests_dir if not custom_actions_dir: custom_actions_dir = tests_dir if not report_file_dir: report_file_dir = tests_dir lang = self.load_language(languages_dir, default_culture) self.configure_ioc( languages_dir=languages_dir, culture=default_culture, tests_dir=tests_dir, file_pattern=file_pattern, actions_dir=actions_dir, pages_dir=pages_dir, base_url=base_url, custom_actions_dir=custom_actions_dir, lang=lang, browser_to_run=browser_to_run, browser_driver=browser_driver, write_report=write_report, report_file_dir=report_file_dir, report_file_name=report_file_name, ) try: self.context = IoC.resolve(PyccuracyContext) except Exception, err: if err.__class__.__name__ == "InvalidScenarioError": print unicode(err.message) return TestResult.empty(lang) else: raise