Forum Discussion

essdee's avatar
essdee
Occasional Contributor
9 years ago

Image response validation

Hi Guys,

 

We can validate HTML text content using LoadComplete which is received as part of the page response.

 

Can we validate images which are received as part of the responses from server? In our application on click of certain buttons, the server serves images on the screen as a response. These responses are of type image/jpeg. Can we validate these image or response type that is received?

 

Since LoadComplete just checks the server response codes, I have noticed that these steps are usually passed and we need to validate whether the server actually sent an image or a correct image.

 

Please help.

 

Thanks.

4 Replies

  • As far as I know, it is not possible to validate images in LoadComplete in the way you are describing. Like Alex mentioned, this sort of validation is better suited for functional testing with a tool like TestComplete.

     

    However, if you just need to verify that the server returned an image file, LoadComplete will do this by default. Looking at your screenshot, your scenario includes a request for that image and expects an HTTP status code of 200 in response from the server. That means that if your server fails to return that image, LoadComplete will flag any response code other than 200 as a warning. (Additionally, you can specify how LoadComplete treats different response codes for this request.)

     

    If you'd like, you can also do some manual spot-checking to make sure the image is being returned as expected. To do this, enable logging of request bodies by going to Tools > Options > Simulating > General  and checking the box next to “Store full headers and bodies.” After doing so, you will be able to consult the Details view of any load testing report to see every image that is returned from the server by looking at the response bodies for any given virtual user.

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I think that you should be able to validate (in this or that extent) the response with the image using Validation functionality of LoadComplete (https://support.smartbear.com/viewarticle/65164/).

    However, I think that you should consider if you are not mixing load and functional testing here.

    It is functional testing (performed manually, or using automation tool like TestComplete) that verifies if the correct image is returned by the server.

    With the load testing, you are verifying that the server can process the given load and the image is returned to the client. I might imagine that you may want to check if the same image is returned by the given response to evary VirtualUser, but I think that the more resource (or CPU)-friendly way is to check something like the value of the Content-Length property from the response header.

    • essdee's avatar
      essdee
      Occasional Contributor

       Hi Alex,

       

      Thanks for your response, I would be checking for 'Content-Type' and 'Content-Length' property to check for valid image response.

       

      However the image responses do not have any of those tabs like 'data selectors' or 'Validation' (these tabs are availabe in HTML/ASPX responses). Please see below screenshot. How are we supposed to validate the response in this case?

       

      image_response.png

       

      Thanks.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > [...] image responses do not have any of those tabs [...]

        Hm-m-m... In this case, probably, the only way to validate is to check the values of the response header properties mentioned by you.

        However, again, I think that the fact that correct image is returned by the server must be done by the functional tests. Load tests verify only that the server can successfully handle the given load.