How to use make_report_saving_strategy method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

reporttests.py

Source:reporttests.py Github

copy

Full Screen

...318 # at least we want to make sure that each of this mode is not failing319 def test_save_at_end_of_tests(self):320 self.test_simple_test(None)321 def test_save_at_each_log(self):322 self.test_simple_test(make_report_saving_strategy("at_each_log"))323 def test_save_at_each_event(self):324 # "at_each_event" has been deprecated in 1.4.5 and replaced by at_each_log325 self.test_simple_test(make_report_saving_strategy("at_each_event"))326 def test_save_at_each_failed_test(self):327 self.test_simple_test(make_report_saving_strategy("at_each_failed_test"))328 def test_save_at_each_test(self):329 self.test_simple_test(make_report_saving_strategy("at_each_test"))330 def test_save_at_each_suite(self):331 self.test_simple_test(make_report_saving_strategy("at_each_suite"))332 def test_save_every_seconds(self):333 self.test_simple_test(make_report_saving_strategy("every_1s"))334 def test_parallelized_tests(self):335 @lcc.suite("Suite")336 class suite:337 @lcc.test("Test 1")338 def test_1(self):339 lcc.log_info("some log")340 @lcc.test("Test 2")341 def test_2(self):342 lcc.log_info("some other log")343 self.do_test_reporting_session(suite, nb_threads=2)344class ReportSerializationTests(ReportingSessionTests):345 def do_test_reporting_session(self, suites, fixtures=(), report_saving_strategy=None, nb_threads=1):346 if type(suites) not in (list, tuple):347 suites = [suites]...

Full Screen

Full Screen

test_project.py

Source:test_project.py Github

copy

Full Screen

...107 def load_suites(self):108 return [load_suite_from_class(suite)]109 project = MyProject(tmpdir.strpath)110 report = run_project(111 project, project.load_suites(), None, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")112 )113 assert report.is_successful()114def test_run_project_with_pre_run(tmpdir):115 pre_run_args = []116 @lcc.suite("suite")117 class suite:118 @lcc.test("test")119 def test(self):120 lcc.log_info("some log")121 class MyProject(Project):122 def pre_run(self, cli_args, report_dir):123 pre_run_args.extend((cli_args, report_dir))124 def load_suites(self):125 return [load_suite_from_class(suite)]126 project = MyProject(tmpdir.strpath)127 report = run_project(128 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")129 )130 assert report.is_successful()131 assert pre_run_args == [NotImplemented, tmpdir.strpath]132def test_run_project_with_pre_run_exception(tmpdir):133 @lcc.suite("suite")134 class suite:135 @lcc.test("test")136 def test(self):137 lcc.log_info("some log")138 class MyProject(Project):139 def pre_run(self, cli_args, report_dir):140 raise Exception("error from pre_run")141 def load_suites(self):142 return [load_suite_from_class(suite)]143 project = MyProject(tmpdir.strpath)144 with pytest.raises(LemoncheesecakeException, match=re.compile("error from pre_run")):145 run_project(146 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")147 )148def test_run_project_with_post_run(tmpdir):149 post_run_args = []150 @lcc.suite("suite")151 class suite:152 @lcc.test("test")153 def test(self):154 lcc.log_info("some log")155 class MyProject(Project):156 def post_run(self, cli_args, report_dir):157 post_run_args.extend((cli_args, report_dir))158 def load_suites(self):159 return [load_suite_from_class(suite)]160 project = MyProject(tmpdir.strpath)161 report = run_project(162 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")163 )164 assert report.is_successful()165 assert post_run_args == [NotImplemented, tmpdir.strpath]166def test_run_project_with_post_run_exception(tmpdir):167 @lcc.suite("suite")168 class suite:169 @lcc.test("test")170 def test(self):171 lcc.log_info("some log")172 class MyProject(Project):173 def post_run(self, cli_args, report_dir):174 raise Exception("error from post_run")175 def load_suites(self):176 return [load_suite_from_class(suite)]177 project = MyProject(tmpdir.strpath)178 with pytest.raises(LemoncheesecakeException, match=re.compile("error from post_run")):179 run_project(180 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")181 )182 session = Session.get()183 assert session.report.is_successful()184def test_run_project_with_build_report_title(tmpdir):185 @lcc.suite("suite")186 class suite:187 @lcc.test("test")188 def test(self):189 lcc.log_info("some log")190 class MyProject(Project):191 def build_report_title(self):192 return "Custom Report Title"193 def load_suites(self):194 return [load_suite_from_class(suite)]195 project = MyProject(tmpdir.strpath)196 report = run_project(197 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")198 )199 assert report.is_successful()200 assert report.title == "Custom Report Title"201def test_run_project_with_build_report_info(tmpdir):202 @lcc.suite("suite")203 class suite:204 @lcc.test("test")205 def test(self):206 lcc.log_info("some log")207 class MyProject(Project):208 def build_report_info(self):209 return [("key", "value")]210 def load_suites(self):211 return [load_suite_from_class(suite)]212 project = MyProject(tmpdir.strpath)213 report = run_project(214 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")215 )216 assert report.is_successful()217 assert report.info == [["key", "value"]]218def test_run_project_with_fixtures(tmpdir):219 test_args = []220 @lcc.fixture()221 def fixt():222 return 42223 @lcc.suite("suite")224 class suite:225 @lcc.test("test")226 def test(self, fixt):227 test_args.append(fixt)228 class MyProject(Project):229 def load_fixtures(self):230 return load_fixtures_from_func(fixt)231 def load_suites(self):232 return [load_suite_from_class(suite)]233 project = MyProject(tmpdir.strpath)234 report = run_project(235 project, project.load_suites(), NotImplemented, [], tmpdir.strpath,236 make_report_saving_strategy("at_end_of_tests")237 )238 assert report.is_successful()239 assert test_args == [42]240def test_run_project_with_fixture_error(tmpdir):241 @lcc.suite("suite")242 class suite:243 @lcc.test("test")244 def test(self, missing_fixture):245 pass246 class MyProject(Project):247 def load_suites(self):248 return [load_suite_from_class(suite)]249 project = MyProject(tmpdir.strpath)250 with pytest.raises(FixtureConstraintViolation):251 run_project(252 project, project.load_suites(), NotImplemented, [], tmpdir.strpath,253 make_report_saving_strategy("at_end_of_tests")254 )255def test_run_project_with_fixture_cli_args(tmpdir):256 test_args = []257 @lcc.suite("suite")258 class suite:259 @lcc.test("test")260 def test(self, cli_args):261 test_args.append(cli_args)262 class MyProject(Project):263 def load_suites(self):264 return [load_suite_from_class(suite)]265 project = MyProject(tmpdir.strpath)266 report = run_project(267 project, project.load_suites(), NotImplemented, [], tmpdir.strpath,268 make_report_saving_strategy("at_end_of_tests")269 )270 assert report.is_successful()271 assert test_args == [NotImplemented]272def test_run_project_with_fixture_project_dir(tmpdir):273 test_args = []274 @lcc.suite("suite")275 class suite:276 @lcc.test("test")277 def test(self, project_dir):278 test_args.append(project_dir)279 class MyProject(Project):280 def load_suites(self):281 return [load_suite_from_class(suite)]282 project = MyProject(tmpdir.strpath)283 report = run_project(284 project, project.load_suites(), NotImplemented, [], tmpdir.strpath,285 make_report_saving_strategy("at_end_of_tests")286 )287 assert report.is_successful()288 assert test_args == [tmpdir.strpath]289def test_run_project_with_custom_nb_threads(tmpdir):290 @lcc.suite("suite")291 class suite:292 @lcc.test("test")293 def test(self):294 lcc.log_info("some log")295 class MyProject(Project):296 def load_suites(self):297 return [load_suite_from_class(suite)]298 project = MyProject(tmpdir.strpath)299 report = run_project(300 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests"),301 nb_threads=2302 )303 assert report.is_successful()304 assert report.nb_threads == 2305def test_run_project_with_force_disabled(tmpdir):306 @lcc.suite("suite")307 class suite:308 @lcc.test("test")309 @lcc.disabled()310 def test(self):311 lcc.log_info("some log")312 class MyProject(Project):313 def load_suites(self):314 return [load_suite_from_class(suite)]315 project = MyProject(tmpdir.strpath)316 report = run_project(317 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests"),318 force_disabled=True319 )320 test, = list(report.all_tests())321 assert test.status == "passed"322def test_run_project_with_stop_on_failure(tmpdir):323 @lcc.suite("suite")324 class suite:325 @lcc.test("test_1")326 def test_1(self):327 lcc.log_error("something wrong happened")328 @lcc.test("test_2")329 def test_2(self):330 lcc.log_info("everything's fine")331 class MyProject(Project):332 def load_suites(self):333 return [load_suite_from_class(suite)]334 project = MyProject(tmpdir.strpath)335 report = run_project(336 project, project.load_suites(), NotImplemented, [], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests"),337 stop_on_failure=True338 )339 test_1, test_2 = list(report.all_tests())340 assert test_1.status == "failed"341 assert test_2.status == "skipped"342def test_run_project_with_reporting_backends(tmpdir):343 @lcc.suite("suite")344 class suite:345 @lcc.test("test")346 def test(self):347 lcc.log_info("some log")348 class MyProject(Project):349 def load_suites(self):350 return [load_suite_from_class(suite)]351 project = MyProject(tmpdir.strpath)352 report = run_project(353 project, project.load_suites(), None, [JsonBackend()], tmpdir.strpath, make_report_saving_strategy("at_end_of_tests")354 )355 assert report.is_successful()...

Full Screen

Full Screen

run.py

Source:run.py Github

copy

Full Screen

...29def get_report_saving_strategy(cli_args):30 saving_strategy_expression = cli_args.save_report or \31 os.environ.get("LCC_SAVE_REPORT") or DEFAULT_REPORT_SAVING_STRATEGY32 try:33 return make_report_saving_strategy(saving_strategy_expression)34 except ValueError as excp:35 raise LemoncheesecakeException(str(excp))36def get_reporting_backend_names(cli_args, project):37 if cli_args.reporting:38 try:39 return do_get_reporting_backend_names(40 project.default_reporting_backend_names, cli_args.reporting41 )42 except ValueError as e:43 raise LemoncheesecakeException("Invalid --reporting argument: %s" % e)44 elif "LCC_REPORTING" in os.environ:45 try:46 return do_get_reporting_backend_names(47 project.default_reporting_backend_names,...

Full Screen

Full Screen

behave.py

Source:behave.py Github

copy

Full Screen

...40 if report_dir:41 os.mkdir(report_dir)42 else:43 report_dir = create_report_dir_with_rotation(top_dir)44 report_saving_strategy = make_report_saving_strategy(45 os.environ.get("LCC_SAVE_REPORT", DEFAULT_REPORT_SAVING_STRATEGY)46 )47 if "LCC_REPORTING" in os.environ:48 try:49 reporting_backend_names = get_reporting_backend_names(50 _DEFAULT_REPORTING_BACKENDS,51 parse_reporting_backend_names_expression(os.environ["LCC_REPORTING"])52 )53 except ValueError as e:54 raise Exception("Invalid $LCC_REPORTING: %s" % e)55 else:56 reporting_backend_names = _DEFAULT_REPORTING_BACKENDS57 reporting_backends = get_reporting_backends_for_test_run(58 {b.get_name(): b for b in get_reporting_backends()}, reporting_backend_names...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Lemoncheesecake automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful