Toad World® Forums

Retrieve unittest specific test data from tabel


#1

I created a driver table to unit test a procedure.
As input parameter i use the file name to validate the file which is uploaded with sqlloader.

My idea was to store all the testfiles is a temp table so i don’t have to load every file with sqlloader. Some file are small and some are very large.

In the unittest i added at the section Pre-execution code
INSERT INTO DPE.DPE_O_FILE
( BESTANDS_NM, VOLG_NR, RECORD_TYPE, DATA_REGEL)
SELECT BESTANDS_NM, VOLG_NR, RECORD_TYPE, DATA_REGEL
FROM QCT.QCT_O_FILE
where bestands_nm = i_P_FILE_NM
;

i_P_FILE_NM is the variable used in the generated code as the input parameter for the file name.

After running the test, every test fails because there is no data.
If I insert all data at once it succeed, but that is not what i want.

After looking at the generated code i’ve the idea that the variable i_P_FILE_NM is not set at the moment of the insert

BEGIN
/* CUSTOM-START PRE-EXECUTION - TESTCASE - {7841BA15-8E09-E08C-E043-ACFADE1FE08C} */
INSERT INTO DPE.DPE_O_FILE (FILE_NM, VOLG_NR, RECORD_TYPE, DATA_LINE
)
SELECT FILE_NM, VOLG_NR, RECORD_TYPE, DATA_LINE
FROM QCT.QCT_O_FILE
WHERE file_nm = i_P_FILE_NM;

/* CUSTOM-END PRE-EXECUTION - TESTCASE - {7841BA15-8E09-E08C-E043-ACFADE1FE08C} */
qu_result_xp.start_dynamic_tc (
test_case_guid_in => ‘{7841BA15-8E09-E08C-E043-ACFADE1FE08C}’,
NAME_IN => ‘DTC:select tc_name from QCT_TD_DPE_P_VERW_O_FILE order by order_by’,
iteration_in => dyntc_index_in,
test_case_result_guid_out => tc_result_guid,
total_iterations_in => l_min_count);
add_input_values (tc_result_guid);

IF qu_result_xp.profiling_enabled
THEN
qu_result_xp.start_profiling (
unit_name_in => ‘DPE_P_VERW_O_FILE’,
test_case_guid_in => qu_result_xp.current_test_case,
test_case_name_in => ‘DTC:select tc_name from QCT_TD_DPE_P_VERW_O_FILE order by order_by’,
test_case_iteration_in => dyntc_index_in);
END IF;

/* Capture start time. /
Q##start_time := DBMS_UTILITY.GET_TIME;
“DPE_P_VERW_O_FILE” (
P_FILE_NM => /
i_P_FILE_NM */
in#730720966#v (
dyntc_index_in),
P_ERR_CD => P_P_ERR_CD,
ERR_MSG => P_ERR_MSG);

Is there a solution to retrieve unittest specific testdata in the Pre-execution code section.
I would be very gratefull

Dirk


#2

Yep, this is a bug. I will try to get this fixed in 1.8.6, which we freeze very soon. If you send me (steven.feuerstein@quest.com) your email address, I will have Quest Support contact you with a ticket number.


#3

After doing some analysis, I have concluded that it is not safe to try to jam this fix into 1.8.6. It will hopefully be in the next 1.9 beta.

My apologies,
SF


#4

Apologies accepted , all the good things comes in twice

I wait for version 1.9 until then I create a workaround

Thanks for quick response

Dirk