When we added the ability to upload a file your test downloaded earlier, the download and the upload had to live in the same test. Now the file can cross a test boundary: one test downloads it, and another test in the same plan uploads it.
With this update, you can set up a round-trip journey for an artifact your application generated while keeping tests short and focused. For example, a test that exports a report can hand the real downloaded file to the test that re-imports it.
Both tests have to run in the same plan, and the test that downloads the file has to run first.
Try it out
On the latest version of the mabl Desktop App:
-
Name the download. In the test that downloads the file, open the download step and fill in Save as file variable. For example:
exportedReport. - Share that test's variables. Open the test's settings and turn on Share variables. The file variable travels to the other tests in the plan along with the test's other variables.
-
Upload a placeholder file in the test that uploads the file. Create a file variable: {x} > Manage variables > Data-driven variables. Give the variable the exact same name as the file variable from the test that downloads the file (e.g.
exportedReport). - Select the placeholder file for your upload step. When you record a file upload step, select "File variable" as the File source and then select the uploaded file variable.
- Organize your plan. The downloading test has to run before the uploading test. Use sequential execution or plan stages to control the order of execution.
At runtime, mabl fetches the file from the downloading test and uploads it. If no file variable by that name reaches the test, the step fails with "file upload reference was not found. The file may not have been downloaded or produced yet."
Requirements and limitations
- File downloads only - a file download is the only way to produce a file variable that another test can use. Files uploaded as data-driven file variables cannot be shared with another test. They stay with the test that declares them.
- Browser tests only - sharing a downloaded file works for browser upload steps; mobile tests and API request bodies cannot upload file variables yet.