class HS.HC.Test.TestCase extends %UnitTest.TestCase, HS.Test.Util

HealthShare aware unit testing class. See also HS.Test.Manager

Differences from %UnitTest.TestCase

A test case class is broken out into 3 types of methods:
  1. Test* methods, that are invoked by the framework. Typically, these methods do a task and check the results.
  2. A series of public class methods for performing a task. These are intended to be called from other test case classes or the command line
  3. Private methods for supporting logic
See HS.Test.Manager for examples on invoking test methods.

Method Inventory


parameter RunAfter;
Specifies other TestCase classes to run before this one


classmethod ChangeToHub()
classmethod CleanupProductionChanges(pTestName)
Remove HS.Generated.{pTestName} items that have been added to a production
classmethod CreateTestClass(pTest, pClass, Output pNewClassName, pIsWebService=0)
pTest - "Test" or "LoadTest"
pClass - "HS.IHE.XDSb.Registry.Services"
pNewClass - value of new class name such as HS.Generated.Test.IHE.XDSb.Registry.Services
method FindAuditRecords(pStartingID, pIsSource, pActionCode, pEventCodesContains, Output pCount, pAuditSourceID="") as %SQL.StatementResult
Find all audit records from a starting point pStartingID - value of FindHighAuditID from before the start of the tests pIsSource - boolean is the source or recipient of the message pActionCode - 'C' 'D' 'R' etc pEventsCodesContains - what to look for in the EventsCodes, ie ITI-52 Output of the count of records found return value of a result set containing the rows found
method FindHighAuditID() as %Integer
Return the highest Audit ID
classmethod GetLastEnsembleSessionID() as %String
method GetOrCreatePatient(pPatientKey As %String = "", Output pPatientSearchResponse, pStandardHub=0) as %Status
Ensure the given patient exists in the MPI and is cached in the session
classmethod GetProductionItemName(pClass, Output pItemName, Output pProdRef As Ens.Config.Production) as %Status
locate production item by Class
method GetXDataAsStream(pXData, ByRef pStream) as %Status
classmethod GetXDataAsStreamWithSubstitutions(pXData, ByRef pStream) as %Status
Make substitions on {$method{}} and {$expression{}} calls - limited to string size
method LogError(message)
Enter an error message in the log
method LogResults(pStatus As %Status = $$$OK, pResults As HS.Types.IHE.Errors = $$$NULLOREF, pExceptions As HS.Types.IHE.Errors = $$$NULLOREF) as %Status
Log results, returning an error status if either the input status or results are an error Errors present in the results and exception list will will not return an error (but will be logged as expected)
classmethod MessagesForItem(pConfigName="", pStart="", Output pCount, pMessageBodyClassName="") as %Integer
Given a configuration name, return the Highest ID given a starting point pConfigName name of configuration item ie HS.IHE.DSUB.NotificationConsumer.Services pStart an optional starting point pCount an output value of the count
method ResponseContainsText(pID, pText)
Given the message header id, get the response message (XMLMessage) and check the ContentStream for the text
classmethod Run(methodname, qspec, userparam) as %Status
Run all test methods for this class
classmethod XDataAsObject(pXData, pClassName, ByRef pObject, pTagName="") as %Status
using an XData correlate to an object after performing substitutions
method XMLGlobalPatientOID()

Inherited Members

Inherited Properties

Inherited Methods