Forum Discussion

twhitehouse1's avatar
twhitehouse1
New Contributor
9 years ago

How to verify an image was successfully uploaded?

I was able to see an image I uploaded using a script from Load Complete by signing in afterwards to view the image on the tested web site.  How can I confirm this in Load Complete without using "200 OK" ( since it can be misleading ) and without manually signing in to view the image?

  • AlexKaras's avatar
    AlexKaras
    9 years ago

    Hi,

     

    > However, I have seen "200 OK" responses and the image not successfully be uploaded.

    In this case I would suggest to talk to developers and ask them how image upload is implemented.

    For example, I can imagine the case when, for the sake of performance and UI responsiveness, some 'main' upload request just informs the server that upload is going to start (and provides the server with some metadata). Server processes this request and responds with 200 code. Then the actual upload starts asynchronously. If this actual upload is done via http then you should be able to find it in the recorded traffic (for example, try to upload a reasonably big file and then look for the request with a body part of a large size). But it is also possible that the actual upload is done via some other protocol and thus is not recorded by LoadComplete. (Though in this case you should *never* see uploaded image because it will never be uploaded during the load playback.)

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    If you really need to check that the image was uploaded, you may record the request that downloads the image from the site and include this request into your load test. To extend this a bit further, given that the image is downloaded as a sequence of encoded bytes, you may create a data selector (using regular expression) and check that returned image contains required signature.

    However, what you are trying to do is a functional testing. It is a functional test that, without any load, verifies that the image can be uploaded and correct image can be downloaded afterwards.

    It the load testing, the goal is to load the server and verify that the server can handle the load. And verification is based exactly on the returned status code because this is how the browser on the client's side works - the operation is considered to be successful if one of 2xx code is returned.

    • twhitehouse1's avatar
      twhitehouse1
      New Contributor

      Thank you for your reply.  I will check to see if there is functionality to also download the image.  That would be perfect and definitely verify that the image was uploaded if it can then be downloaded.

       

      I totally agree with everything you said about load testing and waiting for something like a "200 OK" or as you stated some "2xx" response code.  However, I have seen "200 OK" responses and the image not successfully be uploaded.  We want to make sure that the image is actually there every time, even though this is a load test like you said.  I know its functional testing, but it's good to know anyways in this test as well.  If there is no download option on the server, is there something else I can parse maybe from the upload request itself?   

       

      There also are a few upload requests in which the parameters get built along with way.  So, maybe there is one main upload and as long as that is a "200 OK", then we could assume the upload worked as well?

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > However, I have seen "200 OK" responses and the image not successfully be uploaded.

        In this case I would suggest to talk to developers and ask them how image upload is implemented.

        For example, I can imagine the case when, for the sake of performance and UI responsiveness, some 'main' upload request just informs the server that upload is going to start (and provides the server with some metadata). Server processes this request and responds with 200 code. Then the actual upload starts asynchronously. If this actual upload is done via http then you should be able to find it in the recorded traffic (for example, try to upload a reasonably big file and then look for the request with a body part of a large size). But it is also possible that the actual upload is done via some other protocol and thus is not recorded by LoadComplete. (Though in this case you should *never* see uploaded image because it will never be uploaded during the load playback.)