1、ログ出力モジュール:
。1つの #は/ usr / binに/ PythonのENV! 2 #- * -コーディング:UTF-8 - * - 3。 #@time:2019年11月21日夜05時41 。4 #@Site: 5 #@file:log.py 。6 #@Software:PyCharm 7。 8。 インポート時間 9。 インポートロギング 10 11。 クラスlogOutput(): 12である DEF logOutput(セルフ、LOG_DIR、name_project): 13である '' ' 14 のparam LOG_DIR:ログ・パス 15 :PARAM name_project:プロジェクト名=>ログはにちなんで命名されている 16 :リターン: 17 '' ' 18 #のsys.path.append(os.chdir(' ../ログ')) 19 今= time.strftime(" %Y_%M_%D%H_%M_%S " ) 20 logging.basicConfig (レベル= logging.DEBUG、 21 =フォーマット' %(いるasctime)S%(ファイル名)S [行:%(LINENO)D]%(levelname)S%(メッセージ)S ' 、 22 datefmt = ' %A、% D%B%Y%H:%M:%S ' 23 名= LOG_DIR +今+ ' - ' + name_project + ' _test_log。ログ' 24 ファイルモード= ' W ' ) 25 ロガー= logging.getLogger() 26 logger.info(自己)
2、レポート出力モジュール:
1 #は/ usr /ビン/ ENVパイソン! 2 #- * -コーディング:UTF-8 - * - 3 #@time:2019年11月21日17:44 4 #@Site: 5 #@file:report.py 6 #@Software:PyCharm 7 8 インポート時間 9 インポートunittestの 10 から BSTestRunner インポートBSTestRunner 11 12 クラス:reportOutput() 13 DEF reportOutput(自己、TEST_DIR、report_dir、name_project): 14 ''」 15 :PARAMのTEST_DIR:例のパス 16 :PARAMのreport_dir報告パス 17 :PARAM name_project:プロジェクト名=>名とレポートの説明 18は :リターン: 19 '' ' 20は 今= time.strftime(" %D%Y_%m_Low M_の%S%のH_の%」) 21は、 ディスカバー= unittest.defaultTestLoader.discover(TEST_DIR、パターン= ' テスト*の.py ') #の負荷試験 22で REPORT_NAMEのreport_dir =今+ + ' - ' + + name_project ' _test_report.html ' #レポートタイトル 23 オープン(REPORT_NAME、と' WB ')AS F: # #ファイル名を指定して実行世代例の試験報告書 24 ランナー= BSTestRunner(ストリーム= F、 25 タイトル= name_project + ' UIAuto_Regressionテスト報告書' 、 26は 説明=(name_project + U- 「UIオートメーション回帰試験」)、 27 冗長= 2 ) 28 runner.run(発見) 29 f.close()
3、方法および出力ファイルを呼び出します。
メソッドを呼び出します。
出力スタイル