How to use get_report_filename method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

annotateprocess.py

Source:annotateprocess.py Github

copy

Full Screen

...101 logging.debug("%s" % str(e))102 pass103 # Show report104 try:105 ShowLogDialog(parent, self.preferences, parameters.get_report_filename())106 except:107 message = "Automatic annotation finished.\nSee " + \108 parameters.get_report_filename() + " for details.\n"...

Full Screen

Full Screen

base_case.py

Source:base_case.py Github

copy

Full Screen

...34 try:35 testunit = unittest.TestSuite()36 dynamic_testcase = type(os.path.basename(file), (Case,), {})37 driver = MyDriver.get_driver(device)38 report_file = self.get_report_filename(file,device)39 for test_case in test_case_list:40 #case = Case()4142 # if Field.APP_PACKAGE in test_case:43 # package= test_case[Field.APP_PACKAGE]44 # activity= test_case[Field.APP_ACTIVITY]45 # driver.start_activity(package, activity)46 # case.param=test_case47 # case.driver=driver48 #self.control = Control(self)49 #self.action = Actions(self)50 #self.expectation = Expectation(self)51 #setattr(dynamic_testcase, 'setUp',getattr(case,'setUp'))52 #setattr(dynamic_testcase, 'tearDown',getattr(case,'tearDown'))53 if Field.SET_UP in test_case:54 setattr(dynamic_testcase, 'setUp',Case.exec_cmd(test_case[Field.SET_UP]))55 if Field.TEAR_DOWN in test_case:56 setattr(dynamic_testcase, 'tearDown',Case.exec_cmd(test_case[Field.TEAR_DOWN]))5758 setattr(dynamic_testcase, 'test_'+test_case[Field.TESTCASE_NAME],Case.getTestFunc(driver, test_case,report_file))59 testunit.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(dynamic_testcase))60 fr = codecs.open(report_file,'wb','utf8')61 runner = HTMLTestRunner.HTMLTestRunner(stream=fr,title='自动化测试报告', description='用例执行结果:',report_file_name=report_file)62 runner.run(testunit)63 finally:64 fr.close()65 driver.quit()666768 '''69 Report path70 '''71 def get_report_filename(self,file,device):72 date = time.strftime('%Y-%m-%d', time.localtime(time.time()))73 workingPath =os.path.dirname(os.path.abspath(os.path.dirname(sys.argv[0])))74 s=re.findall(r'(.+?testcase)', str(file))75 s=os.path.join(s[0],os.pardir)76 reports_base_path = s + '/result/report/'77 report_path = reports_base_path + date + '/'78 screenshot_path = reports_base_path + date + '/image/'79 case_name = os.path.basename(file)[:-5]8081 if not os.path.exists(reports_base_path): os.mkdir(reports_base_path)82 if not os.path.exists(report_path): os.mkdir(report_path)83 if not os.path.exists(screenshot_path):84 os.mkdir(screenshot_path)85 shutil.copy(workingPath + r'/pictures/Wal-mart.jpg',screenshot_path + r'logo.jpg') ...

Full Screen

Full Screen

test_file_util.py

Source:test_file_util.py Github

copy

Full Screen

1import pytest2import util.file_util as fu3class TestFileUtil(object):4 def test_get_report_filename(self):5 infile = "dataset/amazon/abcd.csv"6 expected = "reports/abcd-report.csv"7 outfile = fu.get_report_filename(infile)8 assert outfile == expected, "mismatch report file"9 infile = "dataset/amazon/abcd.csv"10 expected = "a/outpath/abcd-report.csv"11 outfile = fu.get_report_filename(infile, "a/outpath/")12 assert outfile == expected, "not handling outpath correctly"13 infile = "dataset/amazon/abcd.csv"14 expected = "/a/outpath/abcd-report.csv"15 outfile = fu.get_report_filename(infile, "/a/outpath/")16 assert outfile == expected, "not handling outpath correctly"17 def test_dir_basename(self):18 infile = "dir/dir2/file.csv"19 expected_dir = "dir/dir2"20 expected_file = "file"21 dir, file = fu.get_dir_basename(infile)22 assert expected_dir == dir, "mismatched dir"23 assert expected_file == file, "mismatched file"24 infile = "/dir/dir2/file.csv"25 expected_dir = "/dir/dir2"26 expected_file = "file"27 dir, file = fu.get_dir_basename(infile)28 assert expected_dir == dir, "mismatched dir"29 assert expected_file == file, "mismatched file"...

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