Forum Discussion

JDR2500's avatar
JDR2500
Occasional Contributor
8 days ago
Solved

"Files diff utility" how does it work? Example?

Hi, I'm interested in using the 'Files diff utility' feature found in Options > Engines > Stores in conjunction with the Files.Compare method.  Ideally, I'd like to get it working with Beyond Compare.  Has anyone used this feature successfully?  Also, any idea if and how will it work with TextExecute?

An example of the usage/syntax would be fabulous.  The documentation is sparse and lacking examples.  This is what I'm talking about:

All the best,

John

  • I followed the documentation that Marsha_R had provided. Did a quick install of BC, ran a file compare test that failed. Clicking on the 'Details' link brings up Beyond Compare showing the differences.

     

12 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I followed the documentation that Marsha_R had provided. Did a quick install of BC, ran a file compare test that failed. Clicking on the 'Details' link brings up Beyond Compare showing the differences.

     

    • JDR2500's avatar
      JDR2500
      Occasional Contributor

      Yes!  Now we're getting somewhere. 

      Which Beyond Compare executable did you specify in the "Diff name" field?  Beyond Compare has at least three of them (e.g. BComp.exe and BCompare.exe).  Also, did you leave default arguments in the "Command line" field?

      I'm still unclear on if/how this will work with TestExecute.  Are these settings saved in the project or project suite?  The nature of the UI makes it look like they are application settings rather than file settings. If it won't work with TestExecute then I may not be able to use it.

      Many thanks, John

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    Here's the reference I found. 

    https://support.smartbear.com/testcomplete/docs/reference/options/engines/stores.html?sbsearch=files%20diff

    It explains how to set up the option, which it looks like you've done. 

    To actually use Files diff, you need one of the comparisons that are also listed on that page

    Files diff utility - The options of this group apply to file checkpoints and PDF checkpoints, to the Compare FilesFile Checkpoint, and PDF Checkpoint operations, and to the Files.CompareFile.Check and File.CheckPDFText methods.

    Pick the comparison that you want to use and go to the documentation for that. Those individual pages have script examples. By setting up the Files diff option, you're telling TC to use your chosen tool instead of what is built in for each of those comparisons.

     

    • JDR2500's avatar
      JDR2500
      Occasional Contributor

      Hi, thanks for the response.

      Yes, that's the reference I found as well.  As you can see there are no examples.  When you call an external comparison tool like Beyond Compare from the command line it returns a value reflecting the results of the comparison.  WinDiff (as old as the hills and not support in Windows 11) and PowerShell's Compare-Object do the same thing. My expectation is that result is subsequently reflected in the TestComplete log as a pass or fail.  Unfortunately, that's not happening.

      If all it does is run the comparison in Beyond Compare and then force me to review an output file from Beyond Compare there is no value in that.  I can just call Beyond Compare directly from a script and accomplish that task.

      The feature implies you can use Beyond Compare as the comparison tool and then get the results back in TestComplete.  There is value in that because Beyond Compare is content aware and can thus use a more appropriate comparison routine (e.g. it will recognize a CSV file and compare the contents of the CSV) to evaluate the files.  

      The Files.Compare method in TestComplete does a binary comparison only.  That is very fragile since subtle formatting changes unrated to the values contained in the CSV will cause a false positive.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Like I said, the examples are given in the documentation for each of the comparisons. There's nothing else to show for Files diff.

        Did you try one of the comparisons with Beyond Compare turned on? What were the results?

    • JDR2500's avatar
      JDR2500
      Occasional Contributor

      Just for reference below is the VBScript code I use with the file comparisons.  It's not working when I try to use the external comparison tool functionality.  It does work when I use the default settings but I get false positives for failures as I previously described.

      If Files.Compare(aFile.Path, s_ResFilePath & aFile.Name, 0, False) Then
                Log.message "Pass: The files matched: " & aFile.Name,
          	  Call aqFile.Delete(aFile.Path) 'Delete the file if the comparison succeeded
              Else
                Log.Warning "Fail: The files did not match: " & aFile.Name
       End If

       

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    This is how it appears in TestExecute. Unfortunately, security settings are preventing the scripts from running

    I don’t like your narcissistic tone/language, that you have used, against a fellow member, who is trying to help you out by gaining more information from you.

    I suggest you read and learn how to use the command lines parameters for BC, and then use that in the file diff utility.

    • JDR2500's avatar
      JDR2500
      Occasional Contributor

      Thanks for giving it a try in TestExecute.  I don't think I'll have the same security issues but I'll find out.

      Additionally, I'm not sure I agree with your assessment that my prior responses were narcissistic.  I'm confident Marsha had good intentions but in this case it seems she did not have the domain knowledge assist me.  

      Directing me to the documentation was simply unhelpful.  That is not a personal attack, but simply a statement of fact.  As noted in my original post, I had already reviewed the documentation and found it lacking.

      I didn't like the tone of the below responses directed against a fellow member (me).  However, if you want to portray me as "the bad guy" I'll accept that.  I can be direct, there is no doubt about that.  I can also be appreciative as you saw in my responses to you.

      Like I said, the examples are given in the documentation for each of the comparisons.

      you have no idea what I know about TestComplete or don't