Page 1 of 2
Testing File Uploads
Your application allows users to upload PDF files.
The upload logic is isolated behind an Adapter:
Which testing strategy provides the best balance of confidence and maintainability?
*
A
In the E2E test, upload a real PDF, inspect its contents, verify every page, and assert that the backend stored the file correctly.
B
In the Integration test, mock the upload Adapter, verify the UI behavior after a successful upload, and use a separate contract test to verify that the Adapter communicates with the API correctly.
C
In the E2E test, spy on FormData.append() and verify that the correct file object was attached to the request.
D
Skip testing uploads entirely because browser APIs and SDKs are already tested by their maintainers.
Submit