Forum Discussion
- rraghvaniChampion Level 3
It is possible to compare two files, see Compare Files Operation
- siddhantoza29New Contributor
Hi, could you please share the code with me? I want to compare two large json files which also has a dynamic value which is the machine IP. This will keep changing as per the CDM deployments. So could you please suggest as to how to handle such json files using testcomplete and VBs. Aslo, if you could share a code for reference?
- AlexKarasChampion Level 3
Hi,
'Comparison' might mean different expected results that you did not mention...
Plain file comparison will indicate whether or not files match as text or binary ones.
You may use, for example, regular expressions (supported by VBScript) to replace irrelevant dynamic data with generic placeholders (for example, replace all ip addresses with '<ip>' string) and then compare files as text ones.
VBScript does not support JSONs. If you really need to work with JSON, you may consider script extension created using JScript which supports work with JSON and call this extension from your VBScript test code (see help for more info on script extensions in TestComplete).
- siddhantoza29New Contributor
Thanks AlexKaras
rraghvani As you suggested it is possible to compare JSONs with Compare Files Operation. I want to compare two large json files which also has a dynamic value which is the machine IP. This will keep changing as per the CDM deployments. So could you please suggest as to how to handle such json files using testcomplete and VBs. Aslo, if you could share a code for reference? - rraghvaniChampion Level 3
I'm hoping that you have read the contents of the link that I had provided, as it mentions the methods to use. Within the documentation, there are references to code examples.
Related Content
- 13 years ago
- 5 months ago
Recent Discussions
- 6 days ago
- 6 days ago
- 9 days ago