Ability upload a file and then download in the same test execution
We need to be able to download a file from our application and then upload that same file within the same test execution, without having to store the file in the local or proof repository. Also would be great if we could rename the file as a command as well.
Hi Marcus,
I can suggest next solution.
Use this snippet in Execute_Java command right after you downloaded this file.
Class Name is com.subject7.DownloadHelper
Method name is getMostRecentFile
It will store the most recent file path in C:\Users\<username>\Downloads to a variable, that you can use after in File_Upload command.
If on your machine files are downloaded to other place, you can override path for search by setting variable DOWNLOAD_FOLDER via Set_Var.
Hello Alexei,
Thank you for the response, I am not able to download the file which you send to me in the link, I see the system s checking for admin login while downloading the file ,i am able to download only jar file
Can you please send me this in zip file, and I never used code snippets in proof and I may need a help from you to setup this in proof.
Can I know your availability so that I will schedule meeting with you
Regards,
Preethi
Preethi
Hi Marcus,
sorry for delay with answer.
Here is link to zip file.
Here is instruction:
- Unzip file to have jar file from archive.
- Go to Artifacts -> File Uploads and upload this jar.
- Go to Artifacts -> Code snippets and create new snippet.
- Select JAR from point #2 in Dependencies dropdown of snippet form and provide Class com.subject7.DownloadHelper
- Go to your test case.
- Add Wait command after the step that starts file download. Add enough timeout to be sure file is downloaded.
- Then add command Execute_Java, select Snippet you have created in point #4 and fill Method field with getMostRecentFile
- As soon as command from point #7 is executed path for downloaded file will be stored to variable @DOWNLOAD_HELPER_MOST_RECENT_FILE, so you can reuse it in other commands.
For file upload you need to use command File_Upload. Unfortunately, right now it allows to upload files that were uploaded to platform before. We will add possibility to use random paths in one of next releases to allow you to use @DOWNLOAD_HELPER_MOST_RECENT_FILE there. We will inform you as soon as update will be released.
Please sign in to leave a comment.