cancel
Showing results for 
Search instead for 
Did you mean: 

Help: Need to compare the JSON data to a PNG report

Highlighted
Occasional Contributor

Help: Need to compare the JSON data to a PNG report

Hello, I would like to compare a JSON file to the content of a Report in PNG to verify the content matches the JSON data, if both matches send a pass, if not send fail with the name that did not match. 

 

Both the JSON file and png file are automatically copied in the same folder (c:\report)

 

I am not much good at coding so if it can be done using Keyword-driven testing it will be best or if you can provide the code I can modify accordingly.

 

Can you provide a sample test using my approach?   Many Thanks  !!!!!

 

JSON File content:

"exportDate": "2020-09-12T08:22:58.610-04:00",
"patientData": "id": "Patient001", "familyName": "Example 2", "givenName": "John Doe",
"birthDate": "07-27-1975T00:00:00",
"gender": "Male",
"ethnicity": "Caucasian\n"

 

PNG File Attachment:

JohnDoeReport.png

 

 

 

 

2 REPLIES 2
Highlighted
Community Hero

Re: Help: Need to compare the JSON data to a PNG report

Hi,

 

You will not be able to get what you need with just Keyword tests.

Exact implementation of what you'd like to get requires optical character recognition (OCR) for the picture file and intelligent match of recognized data to JSON content. For OCR you may consider either old native functionality provided by TestComplete (https://support.smartbear.com/testcomplete/docs/testing-with/deprecated/ocr/index.html) or the new one provided via Google API (https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/ocr/index.html).

 

Implementation does not seem to be trivial, so maybe you should discuss possible alternatives that are more simple in implementation but covers the same verification.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Occasional Contributor

Re: Help: Need to compare the JSON data to a PNG report

Hello Alex,  first of all, thank you for your reply.

 

Seems like my approach is not reliable, comparing a PNG to a JSON file.

 

An alternative test can be getting the JSON data out to a spreadsheet and compare it to a known (expected) data in the spreadsheet.  What would be the right approach to accomplishing this?  Can you send me as script an example?

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors