Forum Discussion

Fixi's avatar
Fixi
New Contributor
8 years ago
Solved

Text files not compared properly

Hello guys,

 

I encoutnered a strange problem. I created a file checkpoint which should compare 2 text files with each other. 

The check point runs fine but when looking at the result I only get a byte difference. 

The support page on the other hand shows a nice line by line comparison for text files.

Am I missing some sort of setting?

 

 

Kind regards

Fixi

  • Using aqTextFile, you could write your own script function to do a line by line comparison.  If they are CSV files or some other delimited data output, you could use the DDT.CSVDriver object to iterate field by field on each line to see if there is a difference. I've never run into a problem using the file check points but then, I've always had need in the past to do the data output comparison of CSV files so I needed something more deliberate than just a file comparison.


5 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Could you show us the actual code you are executing?

    Also, have you verified that the files are purely text and not some sort of ANSI or Unicode files?

  • Fixi's avatar
    Fixi
    New Contributor

    Hello,

     

    first of all thanks for you reply.

    It is just a file checkpoint created with the wizard.

     

    function compare(){
      Files.vorher1.Check("P:\\nacher.txt");
    }

    The files are encoded with UTF-8 because they contain umlauts. Could that be the problem?

  • Fixi's avatar
    Fixi
    New Contributor

    After some more testing I found a possible reason why the text files are not compared as text files.

    It seems that at a certain file size TestComplete stops compairing line by line. I never found this limitation anywhere online but it seems like it.

    Because the files I wanted to compare are 68mb I suspect that is the reason why i dont get line by line comparison.

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Using aqTextFile, you could write your own script function to do a line by line comparison.  If they are CSV files or some other delimited data output, you could use the DDT.CSVDriver object to iterate field by field on each line to see if there is a difference. I've never run into a problem using the file check points but then, I've always had need in the past to do the data output comparison of CSV files so I needed something more deliberate than just a file comparison.