Initial Release
IRIS UnitTest TestCase Template. UnitTest for HL7 Routing Rules in IRIS Integration.
Code consists of:
Also included to demonstrate implementation:
To run all UnitTest on a new UnitTest class manually:
Do ##class(UnitTest.RuleSet.Example).Debug()
When messages are routed they generate logs with two interesting properties:
The output of tests are recorded and available via the normal test url.
This is dispayed at the conclusion of the unit test on the command line.
Leveraging the built-in TestCase Runner we require that the global “UnitTestRoot” points to a physical directory for example “c:\temp”
Set ^UnitTestRoot="c:\temp"
TestCases contain a suite name parameter. So if this is called “RuleSetHL7” you also need to create a subdirectory with this name
mkdir c:\temp\RuleSetHL7
Define a class overriding UnitTest.RuleSet.HL7 :
/// d ##class(UnitTest.RuleSet.Example).Debug() Class UnitTest.RuleSet.Example Extends UnitTest.RuleSet.HL7 {
Parameter TestSuite = "RuleSetHL7";
/// Override for different schema
Parameter HL7Schema = "2.5.1:OUL_R22";/// Override with name of existing service on production
Parameter SourceBusinessServiceName = "From_SystemZ";/// Override with name of existing business process routing engine on production
Parameter TargetConfigName = "MsgRouter";Method TestMessageA()
{
#dim message as EnsLib.HL7.Message
set message=..HL7Message.%ConstructClone(1)
do message.PokeDocType(message.DocType)
do message.SetValueAt("SYSA","MSH:3.1")
set expectSuccess=1
set expectReturn="send:To_SystemA:"
set expectReason="rule#1"
do ..SendMessage(message,"TestMessageA", expectSuccess, expectReturn, expectReason)
}XData SourceMessage
{
}