Best Python code snippet using green
runtest_meng.py
Source:runtest_meng.py
...69 return file_new70if __name__ == '__main__':71 testSuite = unittest.TestSuite()72 # ç»å½æµè¯73 # testSuite.addTest(LoginSpec('test_verify_login'))74 # testSuite.addTest(LoginSpec('test_unexit_username'))75 # testSuite.addTest(LoginSpec('test_wrong_password'))76 # testSuite.addTest(LoginSpec('test_empty_username'))77 # testSuite.addTest(LoginSpec('test_empty_password'))78 # testSuite.addTest(LoginSpec('test_typeerror_username'))79 80 # 设置页é¢81 # testSuite.addTest(SettingSpec('test_go_to_comp_billing_page'))82 # testSuite.addTest(SettingSpec('test_go_to_contact_page'))83 # testSuite.addTest(SettingSpec('test_go_to_mutil_user_page'))84 # testSuite.addTest(SettingSpec('test_go_to_partner_set_page'))85 # testSuite.addTest(SettingSpec('test_go_to_tax_rate_page'))86 # testSuite.addTest(ContactSpec('test_click_add_btn'))87 # å·¥èµ88 # testSuite.addTest(AddStuffSpec('test_name_empty'))89 90 # æ·»å è´¦æ·æµè¯91 # testSuite.addTest(RecordAcountSpec('test_addaccount_1'))92 # testSuite.addTest(RecordAcountSpec('test_same_name'))93 # testSuite.addTest(RecordAcountSpec('test_empty_name'))94 #è®°è´¦æ·äºè½¬ *注æï¼éè¦æ°å¢æåé¶è¡è´¦æ·95 # testSuite.addTest(RecordTransterSpec('test1'))96 # testSuite.addTest(RecordTransterSpec('test2'))97 # testSuite.addTest(RecordTransterSpec('test3'))98 # testSuite.addTest(RecordTransterSpec('test4'))99 # testSuite.addTest(RecordTransterSpec('test5'))100 # testSuite.addTest(RecordTransterSpec('test6'))101 # testSuite.addTest(RecordTransterSpec('test7'))102 # testSuite.addTest(RecordTransterSpec('test8'))103 # # # # # #è®°æ¶ç¥¨æµè¯104 # testSuite.addTest(RecordInputInvoiceSpec('test1'))105 # testSuite.addTest(RecordInputInvoiceSpec('test2'))106 # # # # #è®°å¼ç¥¨æµè¯107 # testSuite.addTest(RecordOutputInvoiceSpec('test1'))108 # testSuite.addTest(RecordOutputInvoiceSpec('test2'))109 # # # # #è®°åºå®èµäº§110 # testSuite.addTest(RecordFixedSpec('test1'))111 # testSuite.addTest(RecordFixedSpec('test2'))112 # # # # # #è®°æ å½¢èµäº§113 # testSuite.addTest(RecordIntangibleSpec('test1'))114 # testSuite.addTest(RecordIntangibleSpec('test2'))115 # #è®°ææçä¸å¡åï¼æ¶å
¥ãæ¯åºãè´¦æ·äºè½¬ãæ¶ç¥¨ãå¼ç¥¨ãåºå®èµäº§ãæ å½¢èµäº§116 # # testSuite.addTest(RecordBusinessSpec('test1'))117 # # testSuite.addTest(RecordBusinessSpec('test2'))118 # # testSuite.addTest(RecordBusinessSpec('test3'))119 # # testSuite.addTest(RecordBusinessSpec('test4'))120 # # testSuite.addTest(RecordBusinessSpec('test5'))121 # # testSuite.addTest(RecordBusinessSpec('test6'))122 # # testSuite.addTest(RecordBusinessSpec('test7'))123 # # testSuite.addTest(RecordBusinessSpec('test8'))124 # # testSuite.addTest(RecordBusinessSpec('test9'))125 # # testSuite.addTest(RecordBusinessSpec('test10'))126 # # ç°éæµé表记æ¶å
¥ï¼æ¯åº127 # testSuite.addTest(RecordTransactionSpecCash('test_record_income_cash'))128 # testSuite.addTest(RecordTransactionSpecCash('test_record_outcome_cash'))129 # ç°éæµé表æ°æ®æ ¡éª130 testSuite.addTest(RecordTransactionSpecCash('test_cashFlows_1'))131 132 # #ä¸å¡æµç¨æµè¯133 # # testSuite.addTest(PositiveFlowSpec('test1'))134 # # testSuite.addTest(PositiveFlowSpec('test2'))135 # # testSuite.addTest(PositiveFlowSpec('test3'))136 # # testSuite.addTest(PositiveFlowSpec('test4'))137 # # testSuite.addTest(PositiveFlowSpec('test5'))138 # # testSuite.addTest(PositiveFlowSpec('test6'))139 # # testSuite.addTest(PositiveFlowSpec('test7'))140 # # testSuite.addTest(PositiveFlowSpec('test8'))141 # # testSuite.addTest(PositiveFlowSpec('test9'))142 # # testSuite.addTest(PositiveFlowSpec('test10'))143 # # testSuite.addTest(PositiveFlowSpec('test11'))144 # #å©çé¦é¡µæµè¯ï¼å¯¼å
¥ï¼145 # # testSuite.addTest(AssistantDashbaordSPec('test1'))146 # testSuite.addTest(AssistantDashbaordSPec('test2'))147 # testSuite.addTest(AssistantDashbaordSPec('test3'))148 # testSuite.addTest(AssistantDashbaordSPec('test4'))149 #ä¼è®¡é¦é¡µæµè¯150 # testSuite.addTest(AccountDashbaordSPec('test1'))151 # testSuite.addTest(AccountDashbaordSPec('test2'))152 #çæåè¯æµè¯ *ã注æãéè¦æ°å¢æåé¶è¡ä¸æ²¡ææµæ°´è®°å½153 # testSuite.addTest(GenerateVoucherSpec('test1'))154 # testSuite.addTest(GenerateVoucherSpec('test2'))155 # testSuite.addTest(GenerateVoucherSpec('test3'))156 #æ¯åº-çæåè¯æµè¯157 # testSuite.addTest(OutcomeVoucherSpec('test1'))158 #pro-èªå¨åæµè¯æ¡ä¾159 # testSuite.addTest(AssistantDashbaordSPec('test1'))160 # testSuite.addTest(AssistantDashbaordSPec('test2'))161 # testSuite.addTest(AssistantDashbaordSPec('test3'))162 # testSuite.addTest(RecordIncomeSpec('test6'))163 # testSuite.addTest(RecordOutcomeSpec('test6'))164 # testSuite.addTest(RecordTransterSpec('test7'))165 # testSuite.addTest(RecordInputInvoiceSpec('test1'))166 # testSuite.addTest(RecordInputInvoiceSpec('test2'))167 # testSuite.addTest(RecordOutputInvoiceSpec('test1'))168 # testSuite.addTest(RecordFixedSpec('test1'))169 # testSuite.addTest(RecordFixedSpec('test2'))170 # testSuite.addTest(RecordIntangibleSpec('test1'))171 # testSuite.addTest(RecordIntangibleSpec('test2'))172 # testSuite.addTest(AssistantDashbaordSPec('test4'))173 # testSuite.addTest(AccountDashbaordSPec('test1'))174 # testSuite.addTest(AccountDashbaordSPec('test2'))175 176 now = time.strftime('%Y-%m-%d %H_%M_%S')177 report_dir = './report'178 filename = report_dir + '/' + now + '_result.html'179 testReport = open(filename,'wb')180 runner = HTMLTestRunner(stream = testReport,title = "管æè´¦æµè¯æ¥å",description='æµè¯ç¨ä¾æ§è¡æ
åµï¼')181 runner.run(testSuite)182 testReport.close()183 # new_report = find_new_report('./report')...
runtest.py
Source:runtest.py
...68 return file_new69if __name__ == '__main__':70 testSuite = unittest.TestSuite()71 # ç»å½æµè¯72 # testSuite.addTest(LoginSpec('test_verify_login'))73 # testSuite.addTest(LoginSpec('test_unexit_username'))74 # testSuite.addTest(LoginSpec('test_wrong_password'))75 # testSuite.addTest(LoginSpec('test_empty_username'))76 # testSuite.addTest(LoginSpec('test_empty_password'))77 # testSuite.addTest(LoginSpec('test_typeerror_username'))78 79 # 设置页é¢80 # testSuite.addTest(SettingSpec('test_go_to_comp_billing_page'))81 # testSuite.addTest(SettingSpec('test_go_to_contact_page'))82 # testSuite.addTest(SettingSpec('test_go_to_mutil_user_page'))83 # testSuite.addTest(SettingSpec('test_go_to_partner_set_page'))84 # testSuite.addTest(SettingSpec('test_go_to_tax_rate_page'))85 # testSuite.addTest(ContactSpec('test_click_add_btn'))86 # å·¥èµ87 # testSuite.addTest(AddStuffSpec('test_name_empty'))88 89 # æ·»å è´¦æ·æµè¯90 # testSuite.addTest(RecordAcountSpec('test_addaccount_1'))91 # testSuite.addTest(RecordAcountSpec('test_same_name'))92 # testSuite.addTest(RecordAcountSpec('test_empty_name'))93 #è®°è´¦æ·äºè½¬ *注æï¼éè¦æ°å¢æåé¶è¡è´¦æ·94 # testSuite.addTest(RecordTransterSpec('test1'))95 # testSuite.addTest(RecordTransterSpec('test2'))96 # testSuite.addTest(RecordTransterSpec('test3'))97 # testSuite.addTest(RecordTransterSpec('test4'))98 # testSuite.addTest(RecordTransterSpec('test5'))99 # testSuite.addTest(RecordTransterSpec('test6'))100 # testSuite.addTest(RecordTransterSpec('test7'))101 # testSuite.addTest(RecordTransterSpec('test8'))102 # # # # # #è®°æ¶ç¥¨æµè¯103 # testSuite.addTest(RecordInputInvoiceSpec('test1'))104 # testSuite.addTest(RecordInputInvoiceSpec('test2'))105 # # # # #è®°å¼ç¥¨æµè¯106 # testSuite.addTest(RecordOutputInvoiceSpec('test1'))107 # testSuite.addTest(RecordOutputInvoiceSpec('test2'))108 # # # # #è®°åºå®èµäº§109 # testSuite.addTest(RecordFixedSpec('test1'))110 # testSuite.addTest(RecordFixedSpec('test2'))111 # # # # # #è®°æ å½¢èµäº§112 # testSuite.addTest(RecordIntangibleSpec('test1'))113 # testSuite.addTest(RecordIntangibleSpec('test2'))114 # #è®°ææçä¸å¡åï¼æ¶å
¥ãæ¯åºãè´¦æ·äºè½¬ãæ¶ç¥¨ãå¼ç¥¨ãåºå®èµäº§ãæ å½¢èµäº§115 # # testSuite.addTest(RecordBusinessSpec('test1'))116 # # testSuite.addTest(RecordBusinessSpec('test2'))117 # # testSuite.addTest(RecordBusinessSpec('test3'))118 # # testSuite.addTest(RecordBusinessSpec('test4'))119 # # testSuite.addTest(RecordBusinessSpec('test5'))120 # # testSuite.addTest(RecordBusinessSpec('test6'))121 # # testSuite.addTest(RecordBusinessSpec('test7'))122 # # testSuite.addTest(RecordBusinessSpec('test8'))123 # # testSuite.addTest(RecordBusinessSpec('test9'))124 # # testSuite.addTest(RecordBusinessSpec('test10'))125 testSuite.addTest(RecordTransactionSpecCash('test_record_income_cash'))126 testSuite.addTest(RecordTransactionSpecCash('test_record_outcome_cash'))127 # #ä¸å¡æµç¨æµè¯128 # # testSuite.addTest(PositiveFlowSpec('test1'))129 # # testSuite.addTest(PositiveFlowSpec('test2'))130 # # testSuite.addTest(PositiveFlowSpec('test3'))131 # # testSuite.addTest(PositiveFlowSpec('test4'))132 # # testSuite.addTest(PositiveFlowSpec('test5'))133 # # testSuite.addTest(PositiveFlowSpec('test6'))134 # # testSuite.addTest(PositiveFlowSpec('test7'))135 # # testSuite.addTest(PositiveFlowSpec('test8'))136 # # testSuite.addTest(PositiveFlowSpec('test9'))137 # # testSuite.addTest(PositiveFlowSpec('test10'))138 # # testSuite.addTest(PositiveFlowSpec('test11'))139 # #å©çé¦é¡µæµè¯ï¼å¯¼å
¥ï¼140 # # testSuite.addTest(AssistantDashbaordSPec('test1'))141 # testSuite.addTest(AssistantDashbaordSPec('test2'))142 # testSuite.addTest(AssistantDashbaordSPec('test3'))143 # testSuite.addTest(AssistantDashbaordSPec('test4'))144 #ä¼è®¡é¦é¡µæµè¯145 # testSuite.addTest(AccountDashbaordSPec('test1'))146 # testSuite.addTest(AccountDashbaordSPec('test2'))147 #çæåè¯æµè¯ *ã注æãéè¦æ°å¢æåé¶è¡ä¸æ²¡ææµæ°´è®°å½148 # testSuite.addTest(GenerateVoucherSpec('test1'))149 # testSuite.addTest(GenerateVoucherSpec('test2'))150 # testSuite.addTest(GenerateVoucherSpec('test3'))151 #æ¯åº-çæåè¯æµè¯152 # testSuite.addTest(OutcomeVoucherSpec('test1'))153 #pro-èªå¨åæµè¯æ¡ä¾154 # testSuite.addTest(AssistantDashbaordSPec('test1'))155 # testSuite.addTest(AssistantDashbaordSPec('test2'))156 # testSuite.addTest(AssistantDashbaordSPec('test3'))157 # testSuite.addTest(RecordIncomeSpec('test6'))158 # testSuite.addTest(RecordOutcomeSpec('test6'))159 # testSuite.addTest(RecordTransterSpec('test7'))160 # testSuite.addTest(RecordInputInvoiceSpec('test1'))161 # testSuite.addTest(RecordInputInvoiceSpec('test2'))162 # testSuite.addTest(RecordOutputInvoiceSpec('test1'))163 # testSuite.addTest(RecordFixedSpec('test1'))164 # testSuite.addTest(RecordFixedSpec('test2'))165 # testSuite.addTest(RecordIntangibleSpec('test1'))166 # testSuite.addTest(RecordIntangibleSpec('test2'))167 # testSuite.addTest(AssistantDashbaordSPec('test4'))168 # testSuite.addTest(AccountDashbaordSPec('test1'))169 # testSuite.addTest(AccountDashbaordSPec('test2'))170 171 now = time.strftime('%Y-%m-%d %H_%M_%S')172 report_dir = './report'173 filename = report_dir + '/' + now + '_result.html'174 testReport = open(filename,'wb')175 runner = HTMLTestRunner(stream = testReport,title = "管æè´¦æµè¯æ¥å",description='æµè¯ç¨ä¾æ§è¡æ
åµï¼')176 runner.run(testSuite)177 testReport.close()178 # new_report = find_new_report('./report')179 # send_mail(new_report)...
smoke_test_runner.py
Source:smoke_test_runner.py
...7if __name__ == '__main__':8 testSuite = unittest.TestSuite()9 10 # # ç»å½æµè¯11 # testSuite.addTest(LoginSpec('test_verify_login'))12 # testSuite.addTest(LoginSpec('test_unexit_username'))13 # testSuite.addTest(LoginSpec('test_wrong_password'))14 # testSuite.addTest(LoginSpec('test_empty_username'))15 # testSuite.addTest(LoginSpec('test_empty_password'))16 # testSuite.addTest(LoginSpec('test_typeerror_username'))17 18 # 设置页é¢19 # testSuite.addTest(SettingSpec('test_go_to_comp_billing_page'))20 # testSuite.addTest(SettingSpec('test_go_to_contact_page'))21 # testSuite.addTest(SettingSpec('test_go_to_mutil_user_page'))22 # testSuite.addTest(SettingSpec('test_go_to_partner_set_page'))23 # testSuite.addTest(SettingSpec('test_go_to_tax_rate_page'))24 25 # 设置ï¼å¸å¥ä¿¡æ¯é¡µé¢26 # testSuite.addTest(CompBillingSpec('test_comp_name_empty'))27 # testSuite.addTest(CompBillingSpec('test_legal_person_name_empty'))28 # testSuite.addTest(CompBillingSpec('test_tax_num_empty'))29 # testSuite.addTest(CompBillingSpec('test_verify_edit_comp_info'))30 31 # 设置ï¼å¾æ¥æ§è´¨(done)32 # testSuite.addTest(ContactSpec('test_show_add_modal'))33 # testSuite.addTest(ContactSpec('test_name_empty'))34 # testSuite.addTest(ContactSpec('test_phone_num_typeError'))35 # testSuite.addTest(ContactSpec('test_contact_input_show'))36 # testSuite.addTest(ContactSpec('test_contact_property_is_unit'))37 # testSuite.addTest(ContactSpec('test_contact_property_is_personal'))38 # testSuite.addTest(ContactSpec('test_name_repeat'))39 40 # 设置ï¼è¡ä¸ä¿¡æ¯(done)41 # testSuite.addTest(PartnersetSpec('test_click_add_btn_modal_is_show'))42 # testSuite.addTest(PartnersetSpec('test_partnerset_empty_invalid'))43 # testSuite.addTest(PartnersetSpec('test_actual_paid_empty_valid'))44 # testSuite.addTest(PartnersetSpec('test_partset_name_repeat_invalid'))45 # testSuite.addTest(PartnersetSpec('test_add_a_partner_valid'))46 # testSuite.addTest(PartnersetSpec('test_edit_partnerset_valid'))47 # testSuite.addTest(PartnersetSpec('test'))48 49 #50 # # å·¥èµï¼æ·»å åå·¥51 # testSuite.addTest(AddStuffSpec('test_name_empty'))52 # testSuite.addTest(AddStuffSpec('test_country_empty'))53 # testSuite.addTest(AddStuffSpec('test_id_empty'))54 # testSuite.addTest(AddStuffSpec('test_employed_empty'))55 # testSuite.addTest(AddStuffSpec('test_verify_add_stuff'))56 # testSuite.addTest(AddStuffSpec('test_verify_add_labour'))57 # testSuite.addTest(AddStuffSpec('test'))58 59 # è®°æ¶æ¯60 # è®°ææç§ç®åè´¦æ·çæ¶æ¯ãäºè½¬61 # testSuite.addTest(RecordTransactionSpec('test_record_income'))62 # testSuite.addTest(RecordTransactionSpec('test_record_outcome'))63 # testSuite.addTest(RecordTransactionSpec('test_record_transfer'))64 65 # # è®°å票66 # # # è®°ææç±»å«å票67 # testSuite.addTest(RecordInvoiceSpec('test_record_input_invoice'))68 # testSuite.addTest(RecordInvoiceSpec('test_record_output_invoice'))69 # testSuite.addTest(RecordInvoiceSpec('test_record_output_invoice_xgm'))70 #71 # æ¥è¡¨72 # 73 # testSuite.addTest(ReportDataReadySpec('test_record_income'))74 # testSuite.addTest(ReportDataReadySpec('test_record_outcome'))75 # testSuite.addTest(ReportDataReadySpec('test_record_transfer'))76 # testSuite.addTest(ReportDataReadySpec('test_record_input_invoice'))77 # testSuite.addTest(ReportDataReadySpec('test_record_output_invoice'))78 79 # external80 # è®°å½å®å
¨é¨æ¶å
¥ãæ¯åºãäºè½¬ï¼ææå表æ¬ææ¶å
¥ä¸º42,650.92ï¼æ¯åºä¸º70,584.3081 # testSuite.addTest(EnterCompSpec('test_enter_comp'))82 # å建å¸å¥83 # testSuite.addTest( CreateCompSpec( 'test_verify_create_comp' ) )84 # testSuite.addTest(CreateCompSpec('test_create_comp_empty_comp_name'))85 # testSuite.addTest(CreateCompSpec('test_create_comp_empty_legal_person'))86 # å¸å¥å表87 # åé
ä¼è®¡ï¼å©çï¼å®¢æè系人88 # testSuite.addTest(DistributeModalSpec('test_distribute_accounting'))89 # å¯ç¨æåå¸é¡µé¢90 testSuite.addTest( BeginningPeriodSpec( 'test_import_initial_account' ) )91 92 # testSuite.addTest(UserSettingSpec('test_go_to_comp_billing_page'))93 # testSuite.addTest(SidebarSpec('test_get_current_account_period'))94 # testSuite.addTest(CreateWaysSpec('test_input_comp_name_jump_to_create_page'))95 96 now = time.strftime( '%Y-%m-%d %H_%M_%S' )97 report_dir = './report/cai_test'98 filename = report_dir + '/' + now + '_result.html'99 testReport = open( filename , 'wb' )100 runner = HTMLTestRunner( stream=testReport , title="管æè´¦æµè¯æ¥å" , description='æµè¯ç¨ä¾æ§è¡æ
åµï¼' )101 runner.run( testSuite )...
form.js
Source:form.js
1(function(has, addtest, cssprop){2 var STR = "string",3 FN = "function"4 ;5 function typeValidates( type ){6 input.setAttribute("type", type);7 input.value = "\x01";8 return has("input-checkvalidity") && input.type == type &&9 (/search|tel/.test(type) || input.value != "\x01" || !input.checkValidity());10 }11 if(!has("dom")){ return; }12 var input = document.createElement("input");13 addtest("input-checkvalidity", function(){14 return has.isHostType(input, "checkValidity");15 });16 addtest("input-attr-autocomplete", function(){17 return ("autocomplete" in input);18 });19 addtest("input-attr-autofocus", function(){20 return ("autofocus" in input);21 });22 addtest("input-attr-list", function(){23 return ("list" in input);24 });25 addtest("input-attr-placeholder", function(){26 return ("placeholder" in input);27 });28 addtest("input-attr-max", function(){29 return ("max" in input);30 });31 addtest("input-attr-maxlength", function(){32 return ("maxLength" in input);33 });34 addtest("input-attr-min", function(){35 return ("min" in input);36 });37 addtest("input-attr-multiple", function(){38 return ("multiple" in input);39 });40 addtest("input-attr-pattern", function(){41 return ("pattern" in input);42 });43 addtest("input-attr-readonly", function(){44 return ("readOnly" in input);45 });46 addtest("input-attr-required", function(){47 return ("required" in input);48 });49 addtest("input-attr-size", function(){50 return ("size" in input);51 });52 addtest("input-attr-step", function(){53 return ("step" in input);54 });55 addtest("input-attr-selectedoption", function(){56 return ("selectedOption" in input);57 });58 addtest("input-attr-indeterminate ", function(){59 return ("indeterminate" in input);60 });61 addtest("input-attr-willvalidate", function(){62 return ("willValidate" in input);63 });64 addtest("input-attr-valueasnumber", function(){65 return ("valueAsNumber" in input);66 });67 addtest("input-attr-valueasdate", function(){68 return ("valueAsDate" in input);69 });70 addtest("input-attr-validity", function(){71 return has.isHostType(input, "validity");72 });73 addtest("input-attr-validationmessage", function(){74 return ("validationMessage" in input);75 });76 addtest("input-attr-willvalidate", function(){77 return ("willValidate" in input);78 });79 addtest("input-type-color", function(){80 return typeValidates("color");81 });82 addtest("input-type-search", function(){83 return typeValidates("search");84 });85 addtest("input-type-tel", function(){86 return typeValidates("tel");87 });88 addtest("input-type-url", function(){89 return typeValidates("url");90 });91 addtest("input-type-email", function(){92 return typeValidates("email");93 });94 addtest("input-type-datetime", function(){95 return typeValidates("datetime");96 });97 addtest("input-type-date", function(){98 return typeValidates("date");99 });100 addtest("input-type-month", function(){101 return typeValidates("month");102 });103 addtest("input-type-week", function(){104 return typeValidates("week");105 });106 addtest("input-type-time", function(){107 return typeValidates("time");108 });109 addtest("input-type-datetime-local", function(){110 return typeValidates("datetime-local");111 });112 addtest("input-type-number", function(){113 return typeValidates("number");114 });115 addtest("input-type-range", function(g, d){116 return typeValidates("range");117 });118 addtest("input-speech", function(g, d){119 return ("speech" in input || "onwebkitspeechchange" in input);120 });...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!