标题: 软件测试--求oracle代码白盒测试用例设计 [打印本页] 作者: clack-kent 时间: 2011-12-1 19:41 标题: 软件测试--求oracle代码白盒测试用例设计 如何对代码编写测试用例?
例如代码:
CREATE OR REPLACE PACKAGE BODY delete_student_pkg AS
type student_id_ttype IS TABLE OF wl_student_tab.STUDENT_ID%TYPE INDEX BY pls_integer;
type course_id_ttype IS TABLE OF wl_course_tab.course_id%TYPE INDEX BY pls_integer;
type sel_course_ttype IS TABLE Of(wl_selected_course_tab.STUDENT_ID,wl_selected_course_tab.COURSE_ID)%TYPE INDEX BY pls_integer;
lt_student_id student_id_ttype;
lt_course_id course_id_ttype;
lt_sel_course sel_course_ttype;
ln_student_id NUMBER;
lv_message VARCHAR2(2000);
app_err_expt EXCEPTION;
PROCEDURE main(p_student_name IN VARCHAR2) AS
BEGIN
SELECT student_id
INTO ln_student_id
FROM wl_student_tab
WHERE student_name = p_student_name;
EXCEPTION
WHEN no_data_found THEN
DBMS_OUTPUT.PUT_LINE(p_student_name || 'student data doesnt exist in wl_student_tab table.');
-- RAISE app_err_expt;
END;
BEGIN
DELETE FROM wl_score_tab wst
WHERE wst.student_id = ln_student_id returning
student_id,course_id bulk collect
INTO lt_student_id,lt_course_id;
DBMS_OUTPUT.PUT_LINE('DELETE COUNT' ||SQL%rowcount );
DBMS_OUTPUT.PUT_LINE('Delectd records list in wl_score_tab table');
FOR i IN 1 .. lt_student_id.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE(lpad('', 2) || 'student id :' || to_char(lt_student_id(i)) || CHR(10) || ' course id : ' || to_char(lt_course_id(i)) || CHR(10) );