Home Corporate Contacts

TETware Knowledgebase


Products
Solutions

Information

Datasheet
Documentation
FAQ
Knowledgebase

Return to Knowledgebase Index

31. How to use the dynamic test case interface in the C API

Suppose 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 tet_getminic() and tet_getmaxic() to determine the IC numbers of the lowest and highest IC, respectively. If your test case contains ICs 1 to 100, you would define these functions as follows:


int tet_getminic(void)
{
	return(1);
}

int tet_getmaxic(void) { return(100); }



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);
}
Before the TCM executes each TP, it needs to set the global API variable 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);
	}

switch (icnum) { case 1: t001(); break; case 2: t002(); break; . . .

case 99: t099(); break; case 100: t100(); break; default: tet_printf("IC %d not allowed for in tet_invoketp()", icnum); break; }

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

  • "Test case structure and management'' and "The Test Case Manager'' in the TETware Programmers Guide.


  • "Test suite structure'' in the TETware User Guide.

 


Home Contacts Legal Copyright Corporate News

Copyright © The Open Group 1995-2012, All Rights Reserved