PDA

View Full Version : Convert text file to excel and compare with actual result



arjun.secbad
12-26-2012, 10:45 PM
Background
As part of our software testing projects, we run few reports of which we extract few text files as output files. We would have to compare those output files layout if it matches the original one as its supposed to be. See Example below..
Expected Result
Description Length Edit Comment
Today’s Date 8 N CCYYMMDD
Filler 1 A
Outlet 9 N
Filler 1 N
Short Name 8 A Outlet Short Name
Filler 1 A
Type 3 A STK
Filler 1 A
Style 3 A See note above
Filler 1 A
Number 6 N Number of plates for Style/Outlet
Filler 1 A
Sign 1 A +

Actual Result
20120604 142384498 DEV STK GP 000006 +
20120604 142384498 DEV STK MC 000002 +
20120604 142384498 DEV STK GP 000001 +
20120604 142384498 AA5 STK GP 000018 +
20120604 148710905 AA5 STK TL 000002 +
20120604 146611073 MRC STK MC 000001 +
20120604 153355186 VT62 STK TL 000001 +
20120604 178895029 MI5 STK GP 000003 +
20120604 172295029 MI5 STK MC 000001 +
20120604 335589709 TRC STK GP 000986 +
20120604 399591059 VT137 STK GP 000004 +

In the above example, it shows that the records are supposed to be extracted as a text file fulfilling these values. It means that Date with length * characters need to come, so on...

What I want?
We need a script which would do the following points.
Ask for input file(Actual extract file in text format).
Ask for actual file to be compared(Expected result file in text format).
Convert input file((Actual extract file in text format) into excel using delimiter & compare the field length as per Actual file and display if its correct or wrong.

Regards,
Ramesh Srinivasan