There are two strings “test_name” that are compared in a VB script. They have to be identical, and they look identical in debug viewer, but StrCompare(string1, string2) returns 1.
History.
This is a test in QTP. The first string is read from Excel. The second one is from a windows application. QTP reads a value from Excel, enters it to a windows form, and then reads the same value from another place. The test passes if these two values are identical.
How to find a difference in these two strings so that I can correct the test?
I would suggest using a
Forloop,Mid, andAsc, to compare the actual characters one by one. Something like (untried code):If they are equal by this test, and unequal by
StrCompthen… I don’t really know. Perhaps try the same thing withLenBandAscBto see if it’s a Unicode or encoding issue somehow.