We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.84).aspx by default does not wait for the command to complete, so Log.Warning(Sys.Clipboard) happens before diff completes. To make it wait you need to specify True as the third parameter of the Run method.
WshShell.Run(diffCmd, 0, True)
Alternatively, you can use Python's built-in https://docs.python.org/3/library/subprocess.html#subprocess.check_output so you won't have to deal with the clipboard:
import subprocess
def diffTwoFilesToLog(file1, file2):
output = subprocess.check_output(["C:\\Program Files (x86)\\GnuWin32\\bin\\diff.exe", file1, file2])
output = output.decode() # convert byte-string to string
Log.Warning(output)
Hi,
I'm interested about how you deal with your diff utility
Personnaly I create a batch file which launches WinMerge with the appropriate left and right file preloaded.
If the test reveals a difference, in my mail I write in html a link which launches the batch file.
m_essaid wrote:Hi,
I'm interested about how you deal with your diff utility
Personnaly I create a batch file which launches WinMerge with the appropriate left and right file preloaded.
If the test reveals a difference, in my mail I write in html a link which launches the batch file.
The purpose of the DIFF above was to verify whether or not the software product I am testing is configured how I think it is before the test gets run (that is in an assumed state). WinMerge is a much better tool if you need a human to look at the data, in this case I do not, so I use GNU DIFF (Linux ported to Windows) which I think works better when a human does not need to intervene. See here:
https://www.gnu.org/software/diffutils/manual/diffutils.html#Invoking-diff
The software configuration is determined by how objects are setup in the product I am testing...so we have a dialog box that gives the user a count of how many types of each object there is. I push that object count text to file, then DIFF that against a 'test control' file and that tells me before the meat of the test gets run that the configuration is not as expected (because it can impact test results). Its one of the checks I have TC/TE run before I allow the test to continue in order to save time on the server (this particular test requires an hour to run).
In another part of the same test I am recursively DIFF-ing two paired folders with a large number of files (both text and binary) in a complex directory tree. So I use these arguments instead for that:
def diffSummaryTwoFolderOutputs(output1, output2, binary):
diffCmd = "\"C:\\Program Files (x86)\\GnuWin32\\bin\\diff.exe\" " + output1 + " " + output2 + " --brief --recursive"
if binary is True:
diffCmd += " --binary"
execResult = WshShell.Exec(diffCmd)
sout = execResult.StdOut.ReadAll()
return sout^Then I put that result in a 'summary report' text file. If there are any differences found, everything gets neatly packaged into a ZIP file (>300MB of data) for later analysis by me or another human to see if the differences found are desirable or not, or just noise. WinMerge, or some other, more human friendly tool is later used for analysis.
ok thank you, it's intereresting