I have a scenario to test where I need to test that the export functionality is working properly or not. I know that usually in these cases, firstly we check the availability of file in location and next the file size.

My problem is that in this case file is automatically getting downloaded to My Downloads folder which is different for different users.

So how do we create a test for this? Also are there any other test cases we need to check. This is the dummy code for how the link behaves(I don't have the actual code right now). Please suggest how to test this properly.


  • Why is it a problem if the My Downloads folder is different for different users? Commented Feb 13, 2017 at 2:26
  • @JoeStrazzere: In this case, my test will fail on remote machines because path will be different there.
    – Ravi
    Commented Feb 13, 2017 at 8:27

2 Answers 2


I could not open your link.

Coincidentally, I came across a test case recently.

  1. Normally, you should be able to choose which folder you want to download your file to. It is better for you to dynamically create such a folder so that no manual intervention is needed once your test is deployed. Doing so should solve this problem for different users.
  2. Your code can create a folder dynamically, verify there is no exported file in this folder, export a file, verify this newly exported file appeared (either by name or other means) then delete this file after verification. This is how I would do it.
  • That's how I would do it too :( Problem here being that it does not allow to choose
    – Ravi
    Commented Feb 12, 2017 at 19:47
  • I replaced the link. Sorry about that.
    – Ravi
    Commented Feb 12, 2017 at 19:50

If you are not going to check file contents, then you'd better make Head HTTP call to the resource, that returns you only file type and its length in the HTTP response headers, instead of downloading entire file. In order to do it, use HTTP library. Another advantage for this approach you may find if you are going to launch test in the cloud based tools, as SauceLabs or Blazemeter.

  • I will need to check the contents. I decided this after re-reading the requirements.
    – Ravi
    Commented Feb 19, 2017 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.