Download - Automating Test File Creation
Automating Test File Creation
Using Excel, UltraEdit, and Batch files to build test data
Barry DeBruin - November 9th, 2004 2
Introduction
• This presentation provides fives steps that users can follow to automate test file creation.
• The example is for creating files used in a code set release where the test files could be identical with the exception of four fields which needed to have a unique code per file.
Barry DeBruin - November 9th, 2004 3
Four Steps
1. Build a “Template” file
2. Preparing your file for Excel
3. Using Excel to update the data
• Using batch files
Barry DeBruin - November 9th, 2004 4
Build a “Template” file
• Start with a clean file (no errors, IG edits, business edits, etc.)
• In our example we’re building X12 837I’s (Institutional health care claims) beginning with the following file.
Barry DeBruin - November 9th, 2004 5
Barry DeBruin - November 9th, 2004 6
Preparing your file for Excel
First we determine differences needed for each file:– We need to change the HCPCS code in three places
and modify the CLM01 for tracking.– To isolate the fields to update, insert a TAB before
and after the field.– Once this is completed, we’ll also need to unwrap
the file by removing the carriage return/line feeds to give us a continuous string of data (~^p with ~). NOTE: The same commands can be used in Word.
Here’s how using UltraEdit…
Barry DeBruin - November 9th, 2004 7
Barry DeBruin - November 9th, 2004 8
Barry DeBruin - November 9th, 2004 9
Barry DeBruin - November 9th, 2004 10
Using Excel to update the data
1. Copy the string of data from UltraEdit to a new workbook in Excel.
2. The tabs will separate your data into their own columns.
• Autofill as many rows as you need test files.
Barry DeBruin - November 9th, 2004 11
Note that each code has it’s own column
Barry DeBruin - November 9th, 2004 12
1. Highlight the entire row.
2. Autofill by using the black cross (hold cursor over black dot)
3. Drag it down as many rows as needed.
Barry DeBruin - November 9th, 2004 13
Barry DeBruin - November 9th, 2004 14
1. You must have the data for each row separated with carriage return/line feeds.
2. Highlight your data and copy it for pasting onto the Excel spreadsheet.
Barry DeBruin - November 9th, 2004 15
Paste into each column requiring an update.
Barry DeBruin - November 9th, 2004 16
You may modify any column as show on these slides.
Barry DeBruin - November 9th, 2004 17
You may modify any column as show on these slides.
Barry DeBruin - November 9th, 2004 18
You may modify any column as show on these slides.
Barry DeBruin - November 9th, 2004 19
You may modify any column as show on these slides.
Barry DeBruin - November 9th, 2004 20
Using batch files
Now we’ll create a batch file to pipe data to multiple files.
• Copy the data from the spreadsheet into a text file and save.
3. Remove all TAB characters.
Barry DeBruin - November 9th, 2004 21
Barry DeBruin - November 9th, 2004 22
Barry DeBruin - November 9th, 2004 23
Barry DeBruin - November 9th, 2004 24
Using batch files, cont’d.
Using UltraEdit we can use column mode to build a working batch file.
• Save this file as a batch file (*.bat).• Identify a unique text pattern on each line.• Using the FINDSTR function from a DOS batch file
we can build our individual files using each rows unique “Text Pattern” (aka Regular Expressions).
• The syntax is as follows:FINDSTR /R "ISA.*I_AE_ADDED_PASS" Example.txt > I_AE_ADDED_PASS.txt
Barry DeBruin - November 9th, 2004 25
Cursor is here
Using Column mode we can insert character into a specific column thereby building our batch file.
Here we are inserting a period in the fourth column to begin building our regular expression.
Barry DeBruin - November 9th, 2004 26
Barry DeBruin - November 9th, 2004 27
Your final batch file should look something like the following.
Barry DeBruin - November 9th, 2004 28
We can see the files build as the batch file runs.