mysql 預存程序 計算報表

來源:互聯網
上載者:User

標籤:

把用例執行情況mysql表匯總起來

 

DELIMITER $$USE `test_cases`$$DROP PROCEDURE IF EXISTS `p_write_report_3`$$CREATE DEFINER=`root`@`localhost` PROCEDURE `p_write_report_3`(IN p_table_name VARCHAR(80),IN p_class_name VARCHAR(80),IN p_method_name VARCHAR(80),IN p_execution_flag VARCHAR(80))BEGIN           DECLARE var_cass_name VARCHAR(80) DEFAULT NULL;   -- 測試類別名    DECLARE var_method_name VARCHAR(80) DEFAULT NULL;  -- 測試方法名    DECLARE var_module VARCHAR(80) DEFAULT NULL;  -- 測試模組 中文    DECLARE var_case_name INT DEFAULT 0; -- 測試案例名稱 中文    DECLARE var_pass_amount INT DEFAULT 0;  --  通過用例數量    DECLARE var_fail_reason VARCHAR(200) DEFAULT NULL;  -- 失敗原因    DECLARE var_comment VARCHAR(200) DEFAULT NULL; -- 備忘    DECLARE var_sql_string VARCHAR(200) DEFAULT NULL; -- sql 語句        SET @var_cass_name = p_class_name;    SET @var_method_name = p_method_name;        SET @var_sql_string = CONCAT("select * from ",p_table_name," where test_method = ‘",p_method_name,"‘ and execution_flag = ‘",p_execution_flag,"‘ and test_class = ‘",p_class_name,"‘ and is_select = 1 and is_pass = 1 ");    SELECT  @var_sql_string;    CALL p_get_select_row_number(@var_sql_string,@var_pass_amount);        SELECT @var_pass_amount;        SET @var_sql_string = CONCAT("select * from ",p_table_name," where test_method = ‘",p_method_name,"‘ and execution_flag = ‘",p_execution_flag,"‘ and test_class = ‘",p_class_name,"‘ and is_select = 1 and is_pass = 0 ");    SELECT  @var_sql_string;    CALL p_get_select_row_number(@var_sql_string,@var_fail_reason);        SELECT @var_fail_reason;                        SELECT GROUP_CONCAT(fail_reason) INTO @fail_reason FROM report LIMIT 10;   IF (SELECT COUNT(*) FROM report  WHERE execution_flag = p_execution_flag   AND class_name = p_class_name AND method_name = p_method_name  ) THEN      UPDATE report SET execution_amount = 22,  pass_amount = 22 , fail_amount = 22,    fail_reason = ‘111‘, COMMENT = ‘1111‘,  TIME = NOW()        WHERE execution_flag = 201603301554 AND class_name = p_class_name  AND method_name = p_method_name  ;     SELECT TRUE,var_fail_reason ,NOW();      ELSE              INSERT  INTO report(`execution_flag`,`class_name`,    `method_name`,`module`,`case_name`,`execution_amount`,    `pass_amount`,`fail_amount`,`fail_reason`,`time`,`comment`)     VALUES (p_execution_flag,p_class_name,    ‘insertResult‘ ,‘暗室逢燈‘,‘是否‘,22,23,    24,‘oooooo‘ ,NOW(),‘ssss‘);                SELECT FALSE,var_fail_reason ,NOW();      END IF;    END$$DELIMITER ;CALL p_write_report_3(‘execution_remote_open‘,‘com.fc.htgl.testcases.TestRemoteOpen‘,‘testCustomerGetExpressError‘,‘201604061017‘);SELECT * FROM report ORDER BY report_id DESC;SELECT * FROM execution_remote_open ORDER BY execution_id DESC;

 

mysql 預存程序 計算報表

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.