Test Input Adapter Reference |
This chapter provides reference material for the test inputs applications programming interface (API), including examples that use code from the RequisitePro adapter. For information about specific declarations, see the following header file:
...Rational Test\rtsdk\c\include\testinputapi.h
The Test Inputs Adapter (TIA) functions are summarized in the following table.
TIConnect()
Connects to the test input source.
TIConnectEx()
Connects to the test input source and supports additional parameters for connection options.
TIDisconnect()
Disconnects from the test input source.
TIExecuteNodeAction()
Executes the specified action against the specified test input node.
TIExecuteSourceAction()
Executes the specified action against the test input source.
TIGetChildren()
Fills an array with the children of a specified parent node.
TIGetConfiguration()
Returns a pointer to a buffer that contains a configuration for the test input source.
TIGetFilterEx()
Returns a pointer to a filter for the test input source.
TIGetIsFunctionSupported()
Indicates whether a specific function is supported by the adapter for an active connection.
TIGetModifiedSince()
Fills an array with input elements modified since a specified date.
TIGetNeedsValidation()
Determines whether an input element requires validation.
TIGetNode()
Returns information about the specified node.
TIGetNodeActions
Returns a pointer to an array of test input actions.
TIGetRoots()
Fills an array with root elements extracted from the input source.
TIGetSourceActions()
Returns a pointer to an array of actions that can be applied to the test input source.
TIGetSourceIcon()
Points to the location of the 16 x 16 bitmap containing the icon that represents the input source in Test Input view.
TIGetTypeIcon()
Points to the location of the bitmap file of the icon that identifies nodes of a specified type.
TISetConfiguration()
Sets the configuration for the test input source based on the specified configuration buffer.
TISetFilter()
Filters display of test input elements.
TISetFilterEx()
Sets the filter for the test input source based on the specified filter buffer.
TIShowProperties()
Displays the property page or dialog box of an input element.
*
TIGetIsChild()
Not currently supported.
*TIGetIsModified()
Not currently supported.
*
TIGetIsModifiedSince()
Determines whether an input element has been modified since a specified date.
*
TIGetIsNode()
Determines whether a specified input element exists.
*
TIGetIsParent()
Determines whether an input element is a parent node.
*TIGetIsValidSource()
Determines whether a specified input source exists.
*
TIGetModified()
Fills an array of structures with input elements that have been modified since the last call to
TIGetModified()
.
*
TIGetName()
Extracts the user-readable name of an input element.
*TIGetParent()
Finds the parent node of an input element.
*
TIGetType()
Extracts the name of the type of an input element.
*
TIGetTypes()
Fills an array with an identifier for each type of input element.
*
TISetValidationFilter()
Filters operations according to validation status.
*TIShowSelectDialog()
Displays the selection dialog for choosing elements from the input source.
Many of the functions in this API make use of parameters of type Node
, which is defined as:
struct Node { char Name[TI_MAX_NAME]; char NodeID[TI_MAX_ID]; char Type[TI_MAX_TYPE]; BOOL IsOnlyContainer; BOOL NeedsValidation; } NodeType;
Name
is the name of the input element displayed in the test input view.
NodeID
is the unique identifier for this input element, assigned by the adapter.
Type
is used for associating this input element with a type (for test inputs that subdivide into types).
If IsOnlyContainer
is set to TRUE
, the input element contains other test input elements and cannot have test cases associated with it.
If NeedsValidation
is set to TRUE
, the input element needs to be tested.
The TIA that you develop is responsible for allocating memory for functions that use pointer-to-pointer parameters, for example TIGetRoots()
. TestManager is responsible for deallocating the memory.
Connects to the test input source.
HRESULTTIConnect
(const TCHARConnectInfo
[TI_MAX_PATH], const TCHARUserID
[TI_MAX_ID], TCHARSourceID
[TI_MAX_ID], TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_UNABLE_TO_CONNECT
. No connection with the input source was possible.
TI_ERROR_INVALID_CONNECTINFO
. The adapter was unable to use the connection information.
This call has been superseded by TIConnectEx()
.
After the connection to an input source has been established, the TIA assigns a unique identifier SourceID,
which can be any string of characters. TestManager uses this identifier for subsequent calls to the adapter. Be sure to document the format of this string. This is particularly important when there are multiple, simultaneous connections.
//********************************************************************
HRESULT TIConnect
(const TCHAR ConnectInfo[TI_MAX_PATH], const TCHAR
UserID[TI_MAX_ID], TCHAR SourceID[TI_MAX_ID], TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Look in the connection map to determine whether a connection with
// the specified RQS file is already established.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(ConnectInfo, (void *&)pContext);
// If there is no active connection for the specified ReqPro
// Project, attempt to connect.
if (!pContext)
{
CFileStatus FileStatus;
// Determine whether a ReqPro RQS project file exists.
if (CFile::GetStatus(ConnectInfo, FileStatus) == TRUE)
{
try
{
/* CODE OMITTED: Establish a connection to the ReqPro
project using the ReqPro COM Server.*/
// If the connection was successful, add the new connection
// context to the connection map.
m_ProjectConnections.SetAt(ConnectInfo, pContext);
// Use the ConnectionInfo as the SourceID.
_tcscpy(SourceID, ConnectInfo);
}
catch (_com_error &e)
{
// If ReqPro COM Server throws an exception, return the
// error using a built in error processing routine.
PopulateErrorDescription(IDS_ERROR_UNABLE_TO_CONNECT,
e.WCode(), e.ErrorMessage(), ErrorDescription);
}
else
{
// The RQS file does not exist, return the appropriate error
// code.
rc = TI_ERROR_INVALID_CONNECTINFO;
}
}
// The connection already exists.
else
{
_tcscpy(SourceID, ConnectInfo);
}
return rc;
}
Creates a connection to a test input source. This method supersedes TIConnect()
; it supports additional parameters for connection options.
HRESULTTIConnectEx
(const TCHARConnectInfo
[TI_MAX_PATH], const TCHARUserID
[TI_MAX_ID], const TIConnectOption *pConnectOptions
, int nOptions, TCHARSourceID
[TI_MAX_ID], TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_UNABLE_TO_CONNECT
. No connection with the input source was possible.
TI_ERROR_INVALID_CONNECTINFO
. The adapter was unable to use the connection information.
The TIA calls this function before calling any other function. After the connection to an input source has been established, the TIA assigns a unique identifier SourceID,
which can be any string of characters. TestManager uses this identifier for subsequent calls to the adapter. SourceID
must remain valid until TIDisconnect()
is called.
//******************************************************************** HRESULT TIConnectEx(const char ConnectInfo[TI_MAX_PATH], const char UserID[TI_MAX_ID], const struct TIConnectOption *pConnectOptions, int nOptions, char SourceID[TI_MAX_ID], char ErrorDescription[TI_MAX_ERROR]) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); HRESULT rc = TI_SUCCESS; // Look in the connection map to determine whether a connection // with the specified RQS file is already established. CConnectionContext *pContext=0; m_ProjectConnections.Lookup(ConnectInfo, (void *&)pContext); // If there is no active connection for the specified ReqPro // Project, attempt to connect. if (!pContext) { CFileStatus FileStatus; // Determine whether a ReqPro RQS project file exists. if (CFile::GetStatus(ConnectInfo, FileStatus) == TRUE) { try { // If ReqPro used connection options, which it does not for (int i=0; i<nOptionCount; i++) { // Then process the connection options } /* CODE OMITTED: Establish a connection to the ReqPro project using the ReqPro COM Server.*/ // If the connection was successful, add the new connection // context to the connection map. m_ProjectConnections.SetAt(ConnectInfo, pContext); // Use the ConnectionInfo as the SourceID. _tcscpy(SourceID, ConnectInfo); } catch (_com_error &e) { // If ReqPro COM Server throws an exception, return the // error using a built in error processing routine. PopulateErrorDescription(IDS_ERROR_UNABLE_TO_CONNECT, e.WCode(), e.ErrorMessage(), ErrorDescription); } } else { // The RQS file does not exist, return the appropriate error // code. rc = TI_ERROR_INVALID_CONNECTINFO; } } // The connection already exists. else { _tcscpy(SourceID, ConnectInfo); } return rc; }
Disconnects from the test input source.
HRESULTTIDisconnect
(const TCHARSourceID
[TI_MAX_ID], TCHARErrorDescription
[TI_MAX_ERROR])
SourceID
input. The handle identifying the connection to the test input source.
ErrorDescription
output. The message to be displayed to the TestManager user if there is an error.
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The specified source information was not correct.
TI_ERROR_UNABLE_TO_DISCONNECT
. There was no existing connection to disconnect from.
After TestManager calls TIDisconnect()
, no further calls to this input source are allowed without another call to TIConnect()
or TIConnectEx()
.
//********************************************************************
HRESULT TIDisconnect
(const TCHAR SourceID[TI_MAX_ID], TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Look in the connection map to determine whether a connection with
// the specified RQS file is already established. Note that the
// ReqPro adapter also uses the path of the RQS file as the
// SourceID.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(ConnectInfo, (void *&)pContext);
// If the context was found, then continue.
if (pContext)
{
/* CODE OMITTED: Close connection to the ReqPro Project by using
the ReqPro COM Server.*/
// Remove the connection from the list of active connections.
m_ProjectConnections.RemoveKey(SourceID);
}
return rc;
}
Executes the specified action against the specified test input node.
HRESULTTIExecuteNodeAction
(const TCHAR SourceID[TI_MAX_PATH], const TCHARNode
[TI_MAX_ID], int nActionID, long lWindowContext, TCHAR ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
//********************************************************************
HRESULT TIExecuteNodeAction
(const TCHAR SourceID[TI_MAX_ID], const
TCHAR Node[TI_MAX_ID], int nActionID, long lWindowContext, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup (sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
switch (nActionID)
{
case 0:
/* CODE OMITED: Execute custom action 1. */
break;
case 1:
/* CODE OMITED: Execute custom action 2. */
break;
default:
rc = TI_ERROR;
_tcscpy(*ErrorDescription,
_T("Unrecognized action received"));
break;
}
return rc;
}
TIGetSourceActions()
,
TIGetNodeActions()
,
TIExecuteSourceAction()
Executes the specified action against the test input source.
HRESULT TIExecuteSourceAction
(const TCHAR
SourceID[TI_MAX_PATH], int nActionID, long lWindowContext,
TCHAR ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
//********************************************************************
HRESULT TIExecuteSourceAction
(const TCHAR SourceID[TI_MAX_ID], int
nActionID, long lWindowContext, TCHAR ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup (sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
switch (nActionID)
{
case 0:
/* CODE OMITED: Execute custom action 1. */
break;
case 1:
/* CODE OMITED: Execute custom action 2. */
break;
default:
rc = TI_ERROR;
_tcscpy(*ErrorDescription,
_T("Unrecognized action received"));
break;
}
return rc;
}
TIGetSourceActions()
,
TIGetNodeActions()
,
TIExecuteNodeAction()
Fills an array with the children of a specified parent node.
HRESULTTIGetChildren
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], struct Node *pChildNodes
[], long *plNodeCount
, TCHARErrorDescription
[TI_MAX_ERROR])
For the definition of type Node
, see "Using the Type Node Structure."
This function typically returns TI_SUCCESS
when the function completes successfully and returns TI_ERROR_INVALID_SOURCEID
if the input source was incorrectly identified.
This function fills pChildNodes
with child elements of a parent node specified by NodeID
. If the parent has no children, pChildNodes
is empty.
You assign the total number of elements written to pChildNodes
to plNodeCount
.
//********************************************************************
HRESULT TIGetChildren
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
NodeID[TI_MAX_ID], struct Node *pChildNodes[], long* plNodeCount,
TCHAR ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
struct Node *pNodeArray=0;
*plNodeCount = 0;
*pChildNodes = 0;
CConnectionContext *pContext=0;
// Lookup the connection information for the ReqPro Project
// identified by SourceID.
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
// Determine whether a connection exists with the specified
// SourceID.
if (pContext)
{
CPtrArray PtrArray;
/* CODE OMITTED: Obtain a collection of child requirements using
ReqPro COM server and store the data for each child requirement
in an instance of class CReqInfo. CReqInfo is a ReqPro adapter
specific class which stores info about each ReqPro
requirement. The instances of CReqInfo are stored in a
pointer array (CPtrArray).*/
// Allocate enough Node data structures for all the children in
// the point array.
pNodeArray = new struct Node[PtrArray.GetSize()];
// Populate the array of Nodes with the data returned by using
// the ReqPro COM server.
for (long lIndex=0; lIndex < PtrArray.GetSize(); lIndex++)
{
// Get an instance of CReqInfo.
CReqInfo *pReqInfo = (CReqInfo *)PtrArray.GetAt(lIndex);
// Copy the requirement name.
_tcscpy(pNodeArray[lIndex].Name, (const char *)
pReqInfo->m_sName);
// Copy the Container and NeedsValidation attributes.
pNodeArray[lIndex].IsOnlyContainer = pReqInfo->m_bContainer;
pNodeArray[lIndex].NeedsValidation =
pReqInfo->m_bNeedsValidation;
// Copy the Requirement NodeID (which is a GUID for a ReqPro
// requirement).
_tcscpy(pNodeArray[lIndex].NodeID, pReqInfo->m_sGUID);
char szNodeType[TI_MAX_TYPE+1];
/* CODE OMITTED: Obtain the name of the requirement type by using
the ReqPro COM server.*/
// Copy the name of requirement type into the node structure.
_tcscpy(pNodeArray[lIndex].Type, (char *) szNodeType);
delete pReqInfo;
}
// Set the return pointer for the node array.
*pChildNodes = pNodeArray;
// Set the count for the number of returned nodes.
*plNodeCount = PtrArray.GetSize();
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Returns a pointer to a buffer that contains a configuration for the test input source.
HRESULTTIGetConfiguration
(const TCHARSourceID
[TI_MAX_PATH], long lWindowContext, TCHAR **pConfigurationBuffer, int *pnConfigurationBufferLength, TCHAR ErrorDescription)
This function typically returns one of the following values:
Typically, the adapter displays a user interface to collect the configuration data.
TestManager is responsible for persisting the data.
//********************************************************************
HRESULT TIGetConfiguration
(const TCHAR SourceID[TI_MAX_ID], long
lWindowContext, TCHAR **pConfigurationBuffer, int*
pnConfigurationBufferLength, TCHAR ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup(sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
*pFilterBuffer = new char[_MAX_PATH];
CWnd ParentWnd;
ParentWnd.FromHandle((HWND)lWindowContext);
/* You have to create a class (A dialog with an embedded
list control to perform configuration selection is used here) */
CSelectConfigDialog Dialog(pContext, &ParentWnd);
if (Dialog.DoModal() == IDOK)
{
_tcscpy(*pConfigurationBuffer,
Dialog.m_sSelectedConfigurationName);
*pnConfigurationBufferLength =
Dialog.m_sSelectedConfigurationName.GetLength();
}
else
{
// Put in blanks to indicate no filter set
CString sEmpty;
_tcscpy(*pConfigurationBuffer, sEmpty);
*pnConfigurationBufferLength = sEmpty.GetLength();
}
return rc;
}
Returns a pointer to a buffer that contains a filter for the test input source.
HRESULT TIGetFilterEx
(const TCHAR SourceID[TI_MAX_PATH],
longlWindowContext, TCHAR **pFilterBuffer, int
*pnFilterBufferLength, TCHAR ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
The filter is returned as a stream of characters.
The data is interpreted only by the adapter.
Typically, the adapter displays a user interface to collect the filter data.
TestManager is responsible for persisting the data.
//********************************************************************
HRESULT TIGetFilterEx
(const TCHAR SourceID[TI_MAX_PATH], long
lWindowContext, TCHAR **pFilterBuffer, int *pnFilterBufferLength,
TCHAR ErrorDescription[TI_MAX_ERROR] )
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup(sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
/* The rest of this code simply displays a dialog that shows the
filter options. It assumes that the dialog saves the filter
settings to the Context pointer. */
if (pContext->m_lpDispatchProject)
{
try
{
CFilterDialog FilterDialog(pContext, NULL);
if (FilterDialog.DoModal() == IDOK)
{
*pnFilterBufferLength =
pContext->GetFilterSettings(pFilterBuffer);
}
else
rc = TI_ERROR;
FilterDialog.DestroyWindow();
}
catch (_com_error)
{
rc = TI_ERROR;
}
}
else
rc = TI_ERROR_INVALID_SOURCEID;
}
return rc;
}
Note: This function is not currently called.
Determines whether an input element is a child node.
HRESULTTIGetIsChild
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], BOOL*pbIsChild
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was incorrectly identified.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
Set the Boolean value pbIsChild
to TRUE
if the element identified in NodeID
is a child. Set the value to FALSE
if the element is not a child.
Indicates whether a specific function is supported by the adapter for an active connection.
HRESULT TIGetIsFunctionSupported
(const TCHAR
SourceID[TI_MAX_PATH], long lFunctionID, BOOL *pbSupported,
TCHAR ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
The lFunctionID
argument can be one of the following:
TI_FUNCTION_TIClearFilter TI_FUNCTION_TIConnect TI_FUNCTION_TIConnectEx TI_FUNCTION_TIDisconnect TI_FUNCTION_TIExecuteNodeAction TI_FUNCTION_TIExecutionSourceAction TI_FUNCTION_TIGetChildren TI_FUNCTION_TIGetConfiguration TI_FUNCTION_TIGetFilterEx TI_FUNCTION_TIGetIsChild TI_FUNCTION_TIGetIsModified TI_FUNCTION_TIGetIsNode TI_FUNCTION_TIGetIsParent TI_FUNCTION_TIGetIsValidSource TI_FUNCTION_TIGetModified TI_FUNCTION_TIGetModifiedSince TI_FUNCTION_TIGetName TI_FUNCTION_TIGetNeedsValidation TI_FUNCTION_TIGetNode TI_FUNCTION_TIGetNodeActions TI_FUNCTION_TIGetParent TI_FUNCTION_TIGetRoots TI_FUNCTION_TIGetSourceActions TI_FUNCTION_TIGetSourceIcon TI_FUNCTION_TIGetType TI_FUNCTION_TIGetTypeIcon TI_FUNCTION_TIGetTypes TI_FUNCTION_TISetConfiguration TI_FUNCTION_TISetFilter TI_FUNCTION_TISetFilterEx TI_FUNCTION_TISetValidationFilter TI_FUNCTION_TIShowProperties TI_FUNCTION_TIShowSelectDialog
//********************************************************************
HRESULT TIGetIsFunctionSupported
(const TCHAR SourceID[TI_MAX_ID],
const TCHAR NodeID[TI_MAX_ID], long lFunctionID, BOOL *pbIsSupported,
TCHAR ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
/* The following is a sample for a minimal adapter with no source
control support. */
switch (lFunctionID)
{
case TI_FUNCTION_TIConnect:
case TI_FUNCTION_TIDisconnect:
case TI_FUNCTION_TIEdit:
case TI_FUNCTION_TIGetIcon:
case TI_FUNCTION_TIGetName:
case TI_FUNCTION_TINew:
case TI_FUNCTION_TISelect:
case TI_FUNCTION_TIShowProperties:
*pbIsSupported = TRUE;
break;
default:
*pbIsSupported = FALSE;
break;
}
return TI_SUCCESS;
}
Note: This function is not currently called.
Determines whether an input element has been modified since the last call to TIGetModified()
.
HRESULTTIGetIsModified
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], BOOL*pbIsModified
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
An element is considered modified if certain properties have changed, particularly properties that affect the way the element is associated with or validated by test cases -- for example, the element's type or its user-readable name.
Set the Boolean value pbIsModified
to TRUE
if the element has been modified since the last call to TIGetModified()
, and set the value to FALSE
if the element has not been modified.
TIGetModified()
,
TIGetIsModifiedSince()
Note: This function is not currently called.
Determines whether an input element has been modified since a specified date.
HRESULTTIGetIsModifiedSince
(const TCHARSourceID
[TI_MAX_ID], const TCHAR NodeID[TI_MAX_ID], struct tmtmDate
, BOOL* pbIsModified, TCHARErrorDescription
[TI_MAX_ERROR])
For the definition of type Node
, see "Using the Type Node Structure."
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
An element is considered modified if certain properties have changed, particularly properties that affect the way the element is associated with or validated by test cases -- for example, the element's type or its user-readable name.
Note: This function is not currently called.
Determines whether a specified input element exists.
HRESULTTIGetIsNode
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], BOOL*pbIsNode
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
Set the Boolean value pbIsNode
to TRUE
if the element is there, and set the value to FALSE
if the element is not there.
//********************************************************************
HRESULT TIGetIsNode
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
NodeID[TI_MAX_ID], BOOL* pbIsNode, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
*pIsNode = FALSE;
// Look in the connection map to determine whether a connection with
// the specified RQS file exists. Note that the ReqPro adapter also
// uses the path of the RQS file as the SourceID.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(ConnectInfo, (void *&)pContext);
if (pContext)
{
/* CODE OMITTED: Determine whether specified NodeID is valid and set
value of *pIsNode based on its validity.*/
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
TIGetIsChild()
,
TIGetIsParent()
Determines whether an input element is a parent node.
HRESULTTIGetIsParent
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], BOOL*pbIsParent
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
Set the Boolean value pbIsParent
to TRUE
if the specified input element (NodeID
) is a parent. Set the value to FALSE
if the input element is not a parent.
//********************************************************************
HRESULT TIGetIsParent
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
NodeID[TI_MAX_ID], BOOL* pIsParent, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS; //
// Look in the connection map to determine whether a connection with
// the specified RQS file exists. Note that the ReqPro adapter also
// uses the path of the RQS file as the SourceID.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
if (pContext)
{
/* CODE OMITTED: Determine if specified NodeID is a parent and set
value of *pbIsParent.*/
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Note: This function is not currently called.
Determines whether the specified test input source exists.
BOOLTIGetIsValidSource
(const TCHARSourceID
[TI_MAX_ID])
SourceID
input. The handle identifying the connection to the test input source.
This function returns a value of TRUE
if the input source exists and returns a value of FALSE
if the input source is not valid.
//********************************************************************
BOOL TIGetIsValidSource
(const TCHAR SourceID[TI_MAX_ID])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
BOOL bValidSource = FALSE;
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
if (pContext)
bValidSource = TRUE;
return bValidSource;
}
Note: This function is not currently called.
Fills an array of structures with input elements that have been modified since the last call to TIGetModified()
.
HRESULTTIGetModified
(const TCHARSourceID
[TI_MAX_ID], struct NodeModifiedNodes
[], long*plNodeCount
, TCHARErrorDescription
[TI_MAX_ERROR])
For the definition of type Node
, see "Using the Type Node Structure."
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
This function determines which elements have been modified since the last call to TIGetModified()
. An element is considered modified if certain properties have changed, particularly properties that affect the way the element is associated with or validated by test cases -- for example, the element's type or its user-readable name. Modified elements are assigned to ModifiedNodes
.
You assign the total number of modified elements to plNodeCount
.
TIGetIsModified()
,
TIGetModifiedSince()
Fills an array of node structures with input elements modified since a specified date.
HRESULTTIGetModifiedSince
(const TCHARSourceID
[TI_MAX_ID], struct tmtmDate
, struct Node *pModifiedNodes
[], long*plNodeCount
, TCHARErrorDescription
[TI_MAX_ERROR])
For the definition of type Node
, see "Using the Type Node Structure."
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
An element is considered modified if certain properties have changed, particularly properties that affect the way the element is associated with or validated by test cases -- for example, the element's type or its user-readable name. You assign modified elements to ModifiedNodes
.
You assign the total number of modified elements to plNodeCount
.
//******************************************************************** HRESULT TIGetModifiedSince(const char SourceID[TI_MAX_ID], struct tm tmDate, struct Node *pModifiedNodes[], long* plNodeCount, char ErrorDescription[TI_MAX_ERROR]) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); HRESULT rc = TI_SUCCESS; try { CTIAConnection *pConnection = 0; // lookup the context information for the specified SourceID if (!theApp.m_ConnectionMap.Lookup(SourceID, (void *&)pConnection))q return TI_ERROR_INVALID_SOURCEID; // if the context was found, then continue if (pConnection) { // Convert the passed in time COleDateTime DateTime; DateTime.SetDateTime(tmDate.tm_year+1900,tmDate.tm_mon+1, tmDate.tm_mday,tmDate.tm_hour,tmDate.tm_min,tmDate.tm_sec); /* CODE OMITTED: Process the new date to see if any of the input has been modified since this date. And populate the NodeArray to return*/ *pModifiedNodes = pNodeArray; *plNodeCount = PtrArray.GetSize(); } else rc = TI_ERROR; } catch(COleException *e) { sprintf(ErrorDescription, "COleException. SCODE: %08lx.", (long)e->m_sc); return TI_ERROR; } catch(COleDispatchException *e) { sprintf(ErrorDescription, "COleDispatchException. SCODE: %08lx,Description: \"%s\".", (long)e->m_wCode, (LPSTR)e->m_strDescription.GetBuffer (TI_MAX_ERROR)); return TI_ERROR; } catch(...) { return TI_ERROR; } return rc; }
TIGetModified()
,
TIGetIsModified()
,
TIGetIsModifiedSince()
Note: This function is not currently called.
Extracts the name of an input element.
HRESULTTIGetName
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], TCHARName
[TI_MAX_NAME], TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
You assign the name of the input element identified in NodeID
to Name
.
//********************************************************************
HRESULT TIGetName
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
NodeID[TI_MAX_ID], TCHAR Name[TI_MAX_NAME], TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Look in the connection map to determine whether a connection with
// the specified RQS file exists.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(ConnectInfo, (void *&)pContext);
// Determine whether a connection exists with the specified
// SourceID.
if (pContext)
{
CString sReqName;
/* CODE OMITTED: Obtain the name for the requirement whose ID is the
value of NodeID and store it in local variable sReqName.
If value of NodeID is not a valid test input, return
TI_NODE_NOT_FOUND.*/
// Copy the name into the return buffer.
_tcsncpy(Name, (const char *)sReqName, TI_MAX_NAME);
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Note: This function is not currently called.
Determines whether an input element requires validation.
HRESULTTIGetNeedsValidation
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], BOOL*pbNeedsValidation
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
Set the value of Boolean pbNeedsValidation
to TRUE
if the input element needs to be validated, and set the value to FALSE
if the input element does not need to be validated.
TIGetModified()
,
TIGetModifiedSince()
,
TISetValidationFilter()
Returns information about the specified node.
HRESULTTIGetNode
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], struct Node **pNode
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns TI_SUCCESS
when the function completes successfully and returns TI_ERROR_INVALID_SOURCEID
if the input source was incorrectly identified.
The definition of type Node
is as follows:
struct Node { char Name[TI_MAX_NAME]; char NodeID[TI_MAX_ID]; char Type[TI_MAX_TYPE]; BOOL IsOnlyContainer; BOOL NeedsValidation; } NodeType;
HRESULT TIGetNode
(TCHAR SourceID[TI_MAX_ID], TCHAR NodeID[TI_MAX_ID],
struct Node **pNode, TCHAR ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = S_OK;
// Look in the connection map to determine if a connection with the
//specified .RQS file exists.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
if (pContext)
{
...
//CODE OMITTED: Obtain the Requirement identified by NodeID and
//store data in instance of CReqInfo.
//CReqInfo is a ReqPro adapter-specific class that stores info
//about a ReqPro requirement.
...
//If value of NodeID is not a valid TestInput, TI_NODE_NOT_FOUND is
//returned.
...
// populate Node structure
*pNode = new struct Node;
// copy Requirement Name
_tcscpy((*pNode)->Name, (const char *)pReqInfo->m_sName);
(*pNode)->IsOnlyContainer = pReqInfo->m_bContainer;
(*pNode)->NeedsValidation = pReqInfo->m_bNeedsValidation;
// copy the Requirement NodeID (which is a GUID for a ReqPro
// requirement)
_tcscpy((*pNode)->NodeID, pReqInfo->m_sGUID);
TCHAR szNodeType[TI_MAX_TYPE+1];
...
// CODE OMITTED: Obtain the name of the Requirement Type via the
// ReqPro COM server
...
// copy the name of requirement type into the node structure
_tcscpy((*pNode)->Type, (char *) szNodeType);
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Returns a pointer to an array of test input actions.
HRESULT TIGetNodeActions
(const TCHAR SourceID[TI_MAX_PATH],
const TCHAR Type[TI_MAX_TYPE], struct Action *pActions[],
int *pnActionCount, TCHAR ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
The Type parameter is empty if no types have been returned.
//********************************************************************
HRESULT TIGetNodeActions
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
Type[TI_MAX_TYPE], struct TIAction *pActions[], int *pnActionCount,
TCHAR ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup(sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
struct TIAction *pTempActions;
pTempActions = new struct TIAction [2];
if ( Type == "FEAT")
{
_tcscpy(pTempActions[0].Name, "Custom Action for features 1\0");
pTempActions[0].ActionID = 0;
_tcscpy(pTempActions[1].Name, "Custom Action features 2\0");
pTempActions[1].ActionID = 1;
}
*pActionCount = 2;
*pActions = pTempActions;
return rc;
}
TIGetSourceActions()
,
TIExecuteNodeAction()
,
TIExecuteNodeAction()
Note: This function is not currently called.
Finds the parent node of an input element.
HRESULTTIGetParent
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], struct Node**pParentNode
, TCHARErrorDescription
[TI_MAX_ERROR])
For the definition of type Node
, see "Using the Type Node Structure."
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
You assign a pointer to the parent node in pParentNode
. If there is no parent for the specified input element, assign a null pointer.
//********************************************************************
HRESULT TIGetParent
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
NodeID[TI_MAX_ID], struct Node **pParentNode, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Look in the connection map to determine whether a connection with
// the specified RQS file exists.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
if (pContext)
{
/* CODE OMITTED: Obtain the parent of the Requirement identified by
NodeID and store data in instance of CReqInfo.
If value of NodeID is not a valid test input,
TI_NODE_NOT_FOUND is returned.*/
// Populate Node structure.
*pParentNode = new struct Node;
// Copy test input name.
_tcscpy((*pParentNode)->Name, (const char *)pReqInfo->m_sName);
(*pParentNode)->IsOnlyContainer = pReqInfo->m_bContainer;
(*pParentNode)->NeedsValidation = pReqInfo->m_bNeedsValidation;
// Copy the Requirement NodeID (which is a GUID for a ReqPro
// requirement).
_tcscpy((*pParentNode)->NodeID, pReqInfo->m_sGUID);
char szNodeType[TI_MAX_TYPE+1];
/* CODE OMITTED: Obtain the name of the requirement type by using
the ReqPro COM server.*/
// Copy the name of requirement type into the node structure.
_tcscpy((*pParentNode)->Type, (char *) szNodeType);
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Fills an array with root elements extracted from the input source.
HRESULTTIGetRoots
(const TCHARSourceID
[TI_MAX_ID], struct Node *pRootNodes
[], long *plNodeCount
, TCHARErrorDescription
[TI_MAX_ERROR])
For the definition of type Node
, see "Using the Type Node Structure."
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
You assign nodes that are root elements to pRootNodes
. If the input source is not hierarchical, fill RootNodes
with all of the elements of the input source.
You assign plNodeCount
the total number of nodes written out to pRootNodes
.
//********************************************************************
HRESULT TIGetRoots
(const TCHAR SourceID[TI_MAX_ID], struct Node
*pRootNodes[], long* plNodeCount, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
struct Node *pNodeArray=0;
*pNodeCount = 0;
*pRootNodes = 0;
CConnectionContext *pContext=0;
// Lookup the connection information for the ReqPro Project
// identified by SourceID.
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
// Determine whether a connection exists with the specified
// SourceID.
if (pContext)
{
CPtrArray PtrArray;
/* CODE OMITTED: Obtain a collection of root nodes using ReqPro
COM server and store the data for Requirement in an instance of
class CReqInfo. CReqInfo is a ReqPro adapter specific class
that stores info about each ReqPro requirement. The instances
of CReqInfo are stored in a pointer array (CPtrArray).*/
// Allocate enough Node data structures for all the root nodes in
// the pointer array.
pNodeArray = new struct Node[PtrArray.GetSize()];
// Populate the array of Nodes with the data returned by using
// the ReqPro COM server.
for (long lIndex=0; lIndex < PtrArray.GetSize(); lIndex++)
{
// Get an instance of CReqInfo.
CReqInfo *pReqInfo = (CReqInfo *)PtrArray.GetAt(lIndex);
// Copy the requirement name.
_tcscpy(pNodeArray[lIndex].Name, (const char
*)pReqInfo->m_sName);
// Copy the Container and NeedsValidation attributes.
pNodeArray[lIndex].IsOnlyContainer = pReqInfo->m_bContainer;
pNodeArray[lIndex].NeedsValidation =
pReqInfo->m_bNeedsValidation;
// Copy the Requirement NodeID (which is a GUID for a ReqPro
// requirement).
_tcscpy(pNodeArray[lIndex].NodeID, pReqInfo->m_sGUID);
char szNodeType[TI_MAX_TYPE+1];
/* CODE OMITTED: Obtain the name of the requirement type by using
the ReqPro COM server.*/
// Copy the name of requirement type into the node structure.
_tcscpy(pNodeArray[lIndex].Type, (char *) szNodeType);
delete pReqInfo;
}
// Set the return pointer for the node array.
* pRootNodes = pNodeArray;
// Set the count for the number of returned nodes.
*plNodeCount = PtrArray.GetSize();
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
TIGetIsNode()
,
TIGetIsParent()
,
TIGetParent()
,
TIGetChildren()
Returns a pointer to an array of actions that can be applied to the test input source.
HRESULT TIGetSourceActions
(const TCHAR SourceID[TI_MAX_PATH],
struct Action *pActions[], int *pnActionCount, TCHAR
ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
//********************************************************************
HRESULT TIGetSourceActions
(const TCHAR SourceID[TI_MAX_ID], struct
TIAction *pActions[], int *pnActionCount, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup(sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
struct TIAction *pTempActions;
pTempActions = new struct TIAction [2];
_tcscpy(pTempActions[0].Name, "Custom Action 1\0");
pTempActions[0].ActionID = 0;
_tcscpy(pTempActions[1].Name, "Custom Action 2\0");
pTempActions[1].ActionID = 1;
*pActionCount = 2;
*pActions = pTempActions;
return rc;
}
TIGetNodeActions()
,
TIExecuteSourceAction()
,
TIExecuteNodeAction()
Points to the location of the 16 x 16 bitmap containing the icon that is displayed with the name of the test input source in the TestManager Test Input view.
HRESULTTIGetSourceIcon
(const TCHARSourceID
[TI_MAX_ID], TCHARIconPath
[TI_MAX_PATH], TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
The source is identified in SourceId
. This icon is also used for all elements of the input source that belong to a type that does not have its own icon.
//********************************************************************
HRESULT TIGetSourceIcon
(const TCHAR SourceID[TI_MAX_ID], TCHAR
IconPath[TI_MAX_PATH], TCHAR ErrorDescription[TI_MAX_ERROR])
{
DWORDdwError;
charszModuleFileName[_MAX_PATH+1];
charszModuleFilePath[_MAX_PATH+1];
charszDir[_MAX_DIR+1];
charszDrive[_MAX_DRIVE+1];
// Obtain the path to where the ReqPro adapter is installed.
dwError=GetModuleFileName((HMODULE)AfxGetInstanceHandle(),
szModuleFileName, _MAX_PATH);
_splitpath(szModuleFileName, szDrive, szDir, NULL, NULL);
// Build the path to where the bitmap file exists.
_tcscpy(szModuleFilePath, szDrive);
_tcscat(szModuleFilePath, szDir);
_tcscat(szModuleFilePath, "bitmap_source.bmp");
// Copy the path into the return variable.
_tcscpy(IconPath, szModuleFilePath);
return TI_SUCCESS;
}
Note: This function is not currently called.
Extracts the name of the type of an input element.
HRESULTTIGetType
(const TCHARSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], TCHARType
[TI_MAX_TYPE], TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
You assign the type of the input element identified in NodeID
to Type
.
//********************************************************************
HRESULT TIGetType
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
NodeID[TI_MAX_ID], TCHAR Type[TI_MAX_NAME], TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Look in the connection map to determine whether a connection with
// the specified RQS file exists.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(ConnectInfo, (void *&)pContext);
// Determine whether a connection exists with the specified
// SourceID.
if (pContext)
{
CString sReqType;
/* CODE OMITTED: Obtain the type for the requirement whose unique ID
is the value of NodeID and store it in local variable sReqType.
If value of NodeID is not a valid test input, return
TI_NODE_NOT_FOUND.*/
// Copy its type into the return buffer.
_tcsncpy(Type, (const char *)sReqType, TI_MAX_TYPE);
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Points to the location of the 16 x 16 bitmap file of the icon that identifies nodes of a specified type.
HRESULTTIGetTypeIcon
(const TCHARSourceID
[TI_MAX_ID], const TCHARType
[TI_MAX_TYPE], TCHARIconPath
[TI_MAX_PATH], TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns TI_SUCCESS
when the function completes successfully and returns TI_ERROR_INVALID_SOURCEID
if the input source information was incorrectly identified.
Use IconPath
to point to the location of the icon that identifies nodes of type Type
.
//********************************************************************
HRESULT TIGetTypeIcon
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
Type[TI_MAX_TYPE], TCHAR IconPath[TI_MAX_PATH], TCHAR
ErrorDescription[TI_MAX_ERROR])
{
DWORDdwError;
charszModuleFileName[_MAX_PATH+1];
charszModuleFilePath[_MAX_PATH+1];
charszDir[_MAX_DIR+1];
charszDrive[_MAX_DRIVE+1];
// Obtain the path to where the ReqPro adapter is installed.
dwError=GetModuleFileName((HMODULE)AfxGetInstanceHandle(),
szModuleFileName, _MAX_PATH);
_splitpath(szModuleFileName, szDrive, szDir, NULL, NULL);
// Build the path to where the bitmap file exists.
_tcscpy(szModuleFilePath, szDrive);
_tcscat(szModuleFilePath, szDir);
_tcscat(szModuleFilePath, "bitmap_type.bmp");
// Copy the path into the return variable.
_tcscpy(IconPath, szModuleFilePath);
return TI_SUCCESS;
}
Note: This function is not currently called.
Fills an array with an identifier for each type of input element.
HRESULTTIGetTypes
(const TCHAR
SourceID
[TI_MAX_ID], TCHAR (**Types
)[TI_MAX_TYPE], long*plTypeCount
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns TI_SUCCESS
when the function completes successfully and returns TI_ERROR_INVALID_SOURCEID
if the input source information was incorrectly identified.
You assign an identifier for each input type to Types
.
You assign the total count of type identifiers to plTypeCount
.
//********************************************************************
HRESULT TIGetTypes
(const TCHAR SourceID[TI_MAX_ID], TCHAR (**
Types)[TI_MAX_TYPE], long* plTypeCount, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Lookup the connection information for the ReqPro Project
// identified by SourceID.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
// Determine whether a connection exists with the specified
// SourceID.
if (pContext)
{
try
{
// Get the ReqPro project interface pointer from the instance
// of CConnectionContext.
ReqServer::_ProjectPtr
ProjectPtr(pContext->m_lpDispatchProject);
// Get the requirement types from the ReqPro project interface
// pointer.
ReqServer::_ReqTypesPtr
MyReqTypesPtr(ProjectPtr->GetReqTypes());
// Allocate enough memory to return the types - (which are
// strings in ReqPro).
*Types = (char (*)[TI_MAX_TYPE]) malloc(sizeof(char) *
MyReqTypesPtr->GetCount() * TI_MAX_TYPE);
// Loop through the requirements types to find the right one.
for (long lIndex = 1; lIndex <= MyReqTypesPtr->GetCount();
lIndex++)
{
COleVariant varIndex=lIndex;
/* CODE OMITTED: Obtain requirement type from collection and
store in variable MyReqTypePtr.*/
// Copy name of requirement type into the return array. Note
// that index of array is 0 based.
_tcscpy((*pszTypes)[lIndex-1], (char
*)MyReqTypePtr->GetName());
}
// Store count of types in return variable.
*plTypeCount = MyReqTypesPtr->GetCount();
}
catch (_com_error)
{
rc = TI_ERROR;
}
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Sets the configuration for the test input source based on the specified configuration buffer.
HRESULT TISetConfiguration
(const TCHAR SourceID[TI_MAX_PATH],
TCHAR *pConfigurationBuffer, int nConfigurationBufferLength,
TCHAR ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
//********************************************************************
HRESULT TISetConfiguration
(const TCHAR SourceID[TI_MAX_ID], TCHAR
*pConfigurationBuffer, int nConfigurationBufferLength, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup(sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
// Persist the raw filter buffer for possible future use by
//TIGetConfigurationEx or
// TICompile, TIEdit, etc...
pContext->m_sConfiguration = pConfigurationBuffer;
/* CODE OMITED: Handle any configuration application actions
needed by the adapter */
return rc;
}
Filters the display of test input elements.
HRESULTTISetFilter
(const TCHARSourceID
[TI_MAX_ID], const TCHARUserID
[TI_MAX_ID], TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
You provide the filter creation mechanism in a window or in a dialog box so that the display of input elements is reduced to a specific set. Filtering information can be stored on a peruser basis.
//********************************************************************
HRESULT TISetFilter
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
UserID[TI_MAX_ID], TCHAR ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Lookup the connection information for the ReqPro Project
// identified by SourceID.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
// Determine whether a connection exists with the specified
// SourceID.
if (pContext)
{
try
{
CFilterDialog FilterDialog(pContext, NULL);
// Display filter dialog.
if (FilterDialog.DoModal())
{
}
}
catch (_com_error)
{
}
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
TISetFilterEx()
,
TISetValidationFilter()
Sets the filter for the test input source based on the specified filter buffer.
HRESULT TISetFilterEx
(const TCHAR SourceID[TI_MAX_PATH], TCHAR
*pFilterBuffer, int nFilterBufferLength, TCHAR
ErrorDescription[TI_MAX_ERROR])
This function typically returns one of the following values:
This function supersedes the function TISetFilter()
.
TestManager is responsible for persisting this data.
//********************************************************************
HRESULT TISetFilterEx
(const TCHAR SourceID[TI_MAX_ID], TCHAR
*pFilterBuffer, int nFilterBufferLength, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
CConnectionContext *pContext=0;
// lookup the context information for the specified SourceID
CString sSourceID = SourceID;
m_ServerConnections.Lookup(sSourceID, (void *&)pContext);
if (pContext == 0)
return TI_ERROR_INVALID_SOURCEID;
/* The remainder of this code is an example of filtering file
based input source. In this sample, the TIGetFilterEx returned
a list of file extensions that were to be hidden from the user.
This example merely parses the filter buffer and stores the
results in the adapter's connection context. TIGetRoots and
TIGetChildren would then use this to determine their output.*/
// Persist the raw filter buffer for possible future use
// by TIGetFilterEx
pContext->m_sFilter = pFilterBuffer;
TCHAR szBuffer[512];
_tcscpy(szBuffer, pFilterBuffer);
char seps[] = ";";
char *token;
pContext->m_asFilterFileExtensions.RemoveAll();
// establish string and get the first token:
token = strtok(szBuffer, seps );
while( token != NULL )
{
CString sToken = token;
sToken.TrimLeft();
sToken.TrimRight();
pContext->m_asFilterFileExtensions.Add(sToken);
// Get next token:
token = strtok( NULL, seps );
} // end while
return rc;
}
Note: This function is not currently called.
Filters operations according to validation status.
HRESULTTISetValidationFilter
(const TCHARSourceID
[TI_MAX_ID], const TCHARUserID
[TI_MAX_ID], BOOLbOnlyNeedsValidation
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
Create a filter so that all operations on the input source (SourceID
) performed by the current tester (UserID
) apply only to elements that need validation. If bOnlyNeedsValidation
is set to False
, filtering by this criterion is disabled.
TISetFilter()
,
TISetFilterEx()
,
TIGetFilterEx()
Displays the property page or dialog box of an input element.
HRESULTTIShowProperties
(TCHAR constSourceID
[TI_MAX_ID], const TCHARNodeID
[TI_MAX_ID], struct Node**pModifiedNode
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
TI_SUCCESS
. The function completed successfully.
TI_ERROR_INVALID_SOURCEID
. The input source was identified incorrectly.
TI_NODE_NOT_FOUND
. The adapter was unable to locate the specified input element.
If any property relevant to TestManager has changed, assign the new information to a Node
structure associated with the pointer pModifiedNode
.
//********************************************************************
HRESULT TIShowProperties
(const TCHAR SourceID[TI_MAX_ID], const TCHAR
NodeID[TI_MAX_ID], struct Node** pModifiedNode, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
// Look in the connection map to determine whether a connection with
// the specified RQS file exists.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
if (pContext)
{
/* CODE OMITTED: Display the ReqPro Requirement Properties dialog
If OK is selected, store relevant information in an instance of
CReqInfo. CReqInfo is a ReqPro adapter-specific class.
If value of NodeID is not a valid test input,
TI_NODE_NOT_FOUND is returned.*/
// Populate Node structure.
*pNode = new struct Node;
// Copy test input name.
_tcscpy((*pModifiedNode)->Name, (const char *)pReqInfo->m_sName);
(*pModifiedNode)->IsOnlyContainer = pReqInfo->m_bContainer;
(*pModifiedNode)->NeedsValidation =
pReqInfo->m_bNeedsValidation;
// Copy the Requirement NodeID (which is a GUID for a ReqPro
// requirement).
_tcscpy((*pModifiedNode)->NodeID, pReqInfo->m_sGUID);
char szNodeType[TI_MAX_TYPE+1];
/* CODE OMITTED: Obtain the name of the requirement type by using
the ReqPro COM server.*/
// Copy the name of requirement type into the node structure.
_tcscpy((*pModifiedNode)->Type, (char *) szNodeType);
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
Note: This function is not currently called.
Displays a selection dialog box for choosing elements from the input source.
HRESULTTIShowSelectDialog
(const TCHARSourceID
[TI_MAX_ID], struct Node*pSelectedNodes
[], long*plNodeCount
, TCHARErrorDescription
[TI_MAX_ERROR])
This function typically returns one of the following values:
This function displays a selection dialog box (supplied by the adapter) for selecting elements from the input source (SourceID
). You assign the selected elements to pSelectedNodes
.
Assign the total number of selected elements to plNodeCount
.
//********************************************************************
HRESULT TIShowSelectDialog
(const TCHAR SourceID[TI_MAX_ID], struct
Node *pSelectedNodes[], long* plNodeCount, TCHAR
ErrorDescription[TI_MAX_ERROR])
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT rc = TI_SUCCESS;
struct Node *pNodeArray=0;
// Look in the connection map to determine whether a connection with
// the specified RQS file exists.
CConnectionContext *pContext=0;
m_ProjectConnections.Lookup(SourceID, (void *&)pContext);
// Determine whether a connection exists with the specified
// SourceID.
if (pContext)
{
CPtrArray PtrArray;
/* CODE OMITTED: Display the RequisitePro Requirement Selection
Dialog. Upon selection of the OK button, extract the selected
requirements and store the data for each requirement in an
instance of class CReqInfo.
CReqInfo is a ReqPro adapter-specific class that stores info
about each ReqPro requirement. The instances of CReqInfo are
stored in a pointer array (CPtrArray).*/
// Allocate enough Node data structures for all the root nodes in
// the pointer array.
pNodeArray = new struct Node[PtrArray.GetSize()];
// Populate the array of Nodes with the data returned by using
// the ReqPro COM server.
for (long lIndex=0; lIndex < PtrArray.GetSize(); lIndex++)
{
// Get instance of CReqInfo.
CReqInfo *pReqInfo = (CReqInfo *)PtrArray.GetAt(lIndex);
// Copy the requirement name.
_tcscpy(pNodeArray[lIndex].Name, (const char
*)pReqInfo->m_sName);
// Copy the Container and NeedsValidation attributes.
pNodeArray[lIndex].IsOnlyContainer = pReqInfo->m_bContainer;
pNodeArray[lIndex].NeedsValidation =
pReqInfo->m_bNeedsValidation;
// Copy the Requirement NodeID (which is a GUID for a ReqPro
// requirement).
_tcscpy(pNodeArray[lIndex].NodeID, pReqInfo->m_sGUID);
char szNodeType[TI_MAX_TYPE+1];
/* CODE OMITTED: Obtain the name of the requirement type by
using the ReqPro COM server.*/
// Copy the name of requirement type into the node structure.
_tcscpy(pNodeArray[lIndex].Type, (char *) szNodeType);
delete pReqInfo;
}
// Set the return pointer for the node array.
*pSelectedNodes = pNodeArray;
// Set the count for the number of returned nodes.
*pNodeCount = PtrArray.GetSize();
}
else
rc = TI_ERROR_INVALID_SOURCEID;
return rc;
}
TIShowProperties()
Rational TestManager Extensibility Reference | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |