most efficient way to code file comparison checkpoints in large quantities
- 8 years ago
What kind of files are you going to make ? do you need to compare context in files or just compare byte codes.?
Test Complete will do comparison byte by byte. In some file types eg - PDF if not similar TC will let you know how many byte differs from original only. But TC can show difference between two text files.
To iterate over sort of list you can use DDT drivers. link
- 8 years ago
Thanks NisHera. Various text file formats, so yes I'll be attempting to use File Vericiation Checkpoints so I can see what has changed. I'll be attempting to use hash to allow files to pass if there is an acceptable % of difference in certain cases.
Anyway, I think the DDT drivers may be the answer I need. I need multiple different rows of values in the Excel or CSV driver though, so I may need to load to an Array in the script/keyword test in order to access the various columns/rows of data to get the values I'm after.
A little concerned about the performance if I have thousands of rows/columns in the spreadsheet... have you used this with a large spreadsheet or CSV before, and if so any latency/issues with scripts running to completion. In other words, is the loading of the DDT Driver content fast?
- 8 years ago
I don't know Python well so forgive me if my syntax is incorrect.
If I understand correctly, Baseline, as it comes from the DDT driver, is a text string that represents the name of the file in the Files store of TestComplete. So, you want to compare that file to what is being created as OBFile, right?
If that's the case, then your comparison should look like this:
# Creates a driver Driver = DDT.ExcelDriver("C:\\SmartBear-DDTDrivers\\BulkCustody.xlsx", "Sheet1") OBFile = aqString.Concat(DDT.CurrentDriver.Value[0], DDT.CurrentDriver.Value[1]) Baseline = DDT.CurrentDriver.Value[2] AllowableDiff = StrToInt(DDT.CurrentDriver.Value[3]) # Perform file comparison for each entry in the Excel file if (Files.Items(Baseline).Check(OBFile, AllowableDiff) == False): Log.Warning("For BaselineFileName" + ": " + aqConvert.VarToStr(DDT.CurrentDriver.Value[2]) + "the file HashCompare is beyond acceptable threshold - Please review OB file and compare against baseline file in SmartBear Repository.", pmHighest)# highest priority else: Log.Message(aqConvert.VarToStr(DDT.CurrentDriver.Value[2]) + "file was verified and is either identical or within acceptable threshold - No further actoin is needed.")
The Files.Items method returns the File object with the indicated name. You can then call the "Check" method of that item as you are doing.