Forum Discussion

LGDTNZ's avatar
LGDTNZ
Occasional Visitor
21 days ago

An increase in OCR API failures

Hi there, i'm wondering if anyone else has noticed a change in the performance of the OCR API?

We run a test suite daily which likely has ~500 OCR API calls.

Up until about a month ago, I'd only ever seen one OCR API failure, however we are now getting 3-4 a day with nothing else changing in regards to the test suite and hardware it's run on. The error is 'Failed to connect to https://ocr.api.dev.smartbear.com. A connection with the server could not be established.'

I have raised with support, but they only really had assistance for if the OCR API wasn't working at all, which isn't the issue here, just the reliability. 

Does anyone have any advice on what could potentially cause an increase in these failures? (or any troubleshooting steps)

Or, has anyone else noticed the same trend?

6 Replies

  • scot1967's avatar
    scot1967
    Icon for Champion Level 1 rankChampion Level 1

    This is worth a try.  I have never used the TestComplete OCR features but you can make API calls in code to attempt to verify an API state/connection and do other testing.

    I would think this would be a flakey network connection or maybe a license issue as rraghvani​ suggested.  Firewall issues are usually consistent failures and less likely.  It will either fail all the time or work.


    Here is some JavaScript that may help.  I just took some code I had and inserted the SmartBear OCR api path.  This should return a failure code in a parsed JSON object. It will likely fail because you are not passing credentials (use resource Query?) to the API but you may be able to determine things about the api and the connection based on the response. 

    function sendGetRequest() 
    {
      let resourcePath =  https://ocr.api.dev.smartbear.com";
      let resourceQuery = "?someparametrer=1234";  // If needed?
      let url = resourcePath + resourceQuery;
      try 
      {
        // Send GET request
        let response = aqHttp.CreateRequest("GET", url, false).Send();
        // Check for successful response
        if (response.StatusCode === 200) 
        {
          // Parse JSON response
          let allData = JSON.parse(response.Text);
          Log.Message("Total records received: " + allData.length);
          // Process each record
          allData.forEach((record, index) => {
            Log.Message("Record " + (index + 1) + ": " + JSON.stringify(record));
          });
        } 
        else 
        {
          Log.Error("Failed to fetch data. Status code: " + response.StatusCode);
        }
      } 
      catch (error) 
      {
        Log.Error("Error during request or data processing: " + error.message);
      }
    }

     

    • Hassan_Ballan's avatar
      Hassan_Ballan
      Icon for Champion Level 1 rankChampion Level 1

      I also believe it could be the result of flaky connection starting from your station to the SmartBear servers. One more thing to consider is proxy server and virus protection, they may interfere see if you can bypass switch off to try.

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Have a read through post OCR Issues | SmartBear Community - I've responded with the following:

    "Have a read through https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/ocr/index.html. If I remember correctly, from reading other posts, OCR is now a web service (ocr.api.dev.smartbear.com). Either the web service is down; consumed x number of licenses or it's being blocked by the firewall."

    Also, have you recently updated TestComplete?

  • scot1967's avatar
    scot1967
    Icon for Champion Level 1 rankChampion Level 1

    Have you dropped the api url into a browser and just opened the page?  There is a wealth of info there!  😎  Just ensuring you get a valid return code from that page before a use of OCR may tell you a lot.

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      That's Swagger, describing RESTful APIs. A UI that renders API documentation based on Swagger/OpenAPI spec file, which users can interact with the API directly from a browser.

      If you know what parameters to pass, you can check the Response Headers, for error information, but that's about it.

      • scot1967's avatar
        scot1967
        Icon for Champion Level 1 rankChampion Level 1

        Right, it's a good troubleshooting step all the same.  You can see the api information, the parameters it expects and even 'Try it out'.  I have used information like this to make calls to APIs from TestComplete that my tested app would normally make and use it to compare the results or verify if the API is even accepting calls or is up at all.  This is very good for intermittent issue where you would like to know more about the failure or exactly what a call is returning. You just call a short function and check what you get as needed and remove it form the test later if you no longer need it.