I'm having a problem comparing files. The twenty first line of the two files I am comparing will always be different (this line is the amount of time it took the computer to complete the file). The other two-hundred plus lines should always be the same. Is there a way in TC3 to allow for this exception? If not, could you recommend a solution to this problem.
I was trying to find a third party app I could use to open and delete the line in the file before doing the call to compare.
Currently TC3 is working the way it should, it fails the comparison everytime.
You could try doing something similar to the following (VBScript):
set fso = CreateObject("Scripting.FileSystemObject")
'open the file you want to compare
set originalFile = fso.OpenTextFile(pathToTheFileYou'reTesting)
'create an empty text file
set modifiedFile = fso.OpenTextFile(path)
'now, read thru each line of the file
Do while not (originalFile.atEndOfStream)
text = originalFile.ReadLine
'if text does not contain whatever's on line
If not InStr(text,"whateverTextStartsOutLine21") then
'write that text out to the modified file
set fso = nothing
Now you can just compare the contents of the modified file to your control document.
There is no built-in way to do this. You can try to use the approach suggested by Nick, or consider Regular Expressions.
A nice example of using Regular Expressions for files comparing was included in the archive with HISUtils plug-in from Eric Holton. Archive for HIS utilities plug-in is available at http://www.automatedqa.com/downloads...te/plugins.asp