Home Corporate Contacts TETware Knowledgebase |
ProductsSolutionsInformationDatasheetDocumentationFAQKnowledgebase |
Return to Knowledgebase Index31. How to use the dynamic test case interface in the C APISuppose you have a test case that contains 100 Test Purpose functions.You must first decide how your Test Purpose functions are to be distributed between the Invocable Components in your test case. (Recall that a test case contains one or more ICs and that each IC can contain one or more TPs; thus an IC is a logical grouping of TP functions.) The simplest way is probably to allocate one TP to each IC. In this case, your test case will contain 100 ICs, numbered 1 to 100. Each IC will contain a single TP. The TCM uses the interface functions to find out how your test case is
organised.
First, the TCM calls
int tet_getminic(void) { return(1); } Then, for each IC number in this range, the TCM calls tet_isdefic()
to
determine whether you have defined a particular IC.
Since your test case contains all the ICs in the range 1 to 100, you
might define this function as follows:
int tet_isdefic(int icnum) { if (icnum >= tet_getminic() && icnum <= tet_getmaxic()) return(1); else return(0); } When the TCM is about to execute the TP function(s) in each IC, it calls tet_gettpcount()
to determine the number of TPs in each IC.
Since your test case is to be organised with just one TP in each IC,
you might define this function as follows:
int tet_gettpcount(int icnum) { if (tet_isdefic(icnum)) return(1); else return(0); } tet_thistest
to the absolute test number within the test case.
The TCM calls
tet_gettestnum()
to do this.
Since your test case is to be organised with just one TP in each IC and
since the IC numbers start at one, the absolute test number is the same
as the IC number.
So you might define this function as follows:
int tet_gettestnum(int icnum, int tpnum) { if (tet_isdefic(icnum) && tpnum == 1) return(icnum); else return(0); } Finally, the TCM calls tet_invoketp()
to invoke each test purpose
function.
Since your test case is to be organised with just one TP in each IC,
the function number to execute is the same as the IC number.
So you might define this function as follows:
int tet_invoketp(int icnum, int tpnum) { if (tpnum != 1) { tet_printf("TP %d within IC %d not allowed for \ in tet_invoketp()", tpnum, icnum); return(0); } The diagnostic messages are not mandatory but might be useful to detect an inconsistency between the code in tet_invoketp()
and the test case
layout information that is returned by the other interface functions.
See also
|