AutoTestFunc

Description

AutoTestFunc runs one or more test cases in an auto test.

C Prototype

void EXTFUN AutoTestFunc(
lpSERVERINFO lpServer); /* Input:  Test information */

Arguments

lpServer

The lpServer argument is a SERVERINFO structure containing information that includes the test cases to run, the test source to run them against, and how to run them. The SERVERINFO structure is defined in the AUTOTEST.H file. It has the following members:

Return Value

None.

Comments

ODBC Test calls this function to run one or more test cases in the auto test. If the szSource member of the SERVERINFO structure specified in the lpServer argument is ODBC Test Handles, AutoTestFunc uses the handles specified in the henv, hdbc, and hstmt members. Otherwise, it connects to the data source specified in the szValidServer0 member using the information in the szValidLogin0, szValidPassword0, and szKeywords members.

AutoTestFunc runs the test cases specified in the rglMask member, using the GETBIT macro to determine which bits are set. It calls szLogPrintf to send output to the screen or log file and stores the total number of errors encountered in the cErrors member.

Code Example

The following code example shows a simple AutoTestFunc function and supporting function:

void EXTFUN AutoTestFunc(lpSERVERINFO lpServer)
{
   UINT iCase;

   InitTest(lpServer);

   /* Loop through the rglMask bitmask with the */
    /* GETBIT macro to determine the test cases */
   /* to run. NumTests is the count of test */
   /* cases returned by AutoTestName. */

   for (iCase = 1; iCase = NumTests; iCase++)
      if (GETBIT(lpServer->rglMask, iCase))
         RunTestCase(lpServer, iCase);

   EndTest(lpServer);
}

void INTFUN RunTestCase(lpSERVERINFO lpServer, UINT iCase);
{
   szLogPrintf(lpServer, FALSE, "Running test case %u.\r\n", iCase);

   /* Run the test case specified by iCase. */

   szLogPrintf(lpServer, FALSE, "Test case %u finished.\r\n", iCase);
}