Test: Make Data Comparable
For regression testing to be effective one needs a way of comparing the inputs and outputs.
The solution I decided to go for was to write a To Translator component using Lua’s file handling logic to output each outbound message from both the old and new logic into it’s own file named <Message Control ID>.txt.
This is very easy to do with Iguana 5 since we have random access to the HL7 tree and the the file handling APIs. I set up one channel with the original logic like this:
From DB –> To Translator.
This is the configuration of the From DB part:
And the destination tab:
I clicked on Edit Script… to get the initial editor dialog and selected Blank Project:
Then I edited the project to get the basic “Hello World” script:
I clicked save milestone to get the first milestone saved:
Then I ran the channel and got 20 messages processed. At this stage nothing is being done to these messages. So my next step was to export these messages from the logs into the Translator so we can write the code to save each one into it’s own text file.
I went to the Logs tab and altered the search criteria to find the messages like so:
Then I clicked on the Export link below the Bookmark Search button:
And clicked on “Export to Translator”. In the dialog which came up I selected the destination as
After clicking Export this dialog comes up:
Which makes it easy to edit into the editor. Then I altered the main module to use a new routine I created in dbfill:
The dbfill.SaveMessage routine had the following simple code:
So I save the current milestone and then requeued the messages. This can be done by:
- Making sure the channel is stopped.
- Clicking on the “Queued” column in the dashboard.
This gives you a view something like this:
Then using the down arrow at the top right to scroll down to the bottom:
And repositioning the channel by clicking on the PROCESSED icon:
From there this dialog comes up:
Clicking on “Start here” sets the queue at the beginning point. After that I restarted the channel and ended up with all my destination messages from the original code, converted into text files sitting in D:\temp:
This provides a convenient data set from which to compare our output messages from the Translator Filter component we wrote in the first part of the tutorial.
Now that we have an original data set, the next step is compare the old and new data.