Sunday, June 8, 2014

upload file

Some applications may require user to upload the file and since it is part of the workflow, without it, the test can be executed end to end, so it is necessary to add the support for file upload.

Actually file upload is simpler than you think, even it appears like you have to browser the folder to find the file, but it is not a case when you do test automation. The browsing part of the function of the browser, it is out of your control so you don't need to test that part. As tester, we only test the part we are responsible for, for example, after you choose the file, click the button and the file should be sent to server and process by the application. So we can use put the file under test source folder and use Java File to locate it and convert the file into a file and use it for the testing.





We can put the file to be uploaded inside /test/resources/upload/ folder and refer it in the test.



The button doesn't submit the form, it just alert a message instead, so the last part of the test is to accept the alert.

The test can be managed by Spring as well,

1 comment:

  1. Thanks for the article, excellent stuff especially enjoyed the points you covered in Benefits section.
    You can get info on "Selenium Training Series" as well with some guidelines with different way of thinking.

    ReplyDelete