Upload attachments to tests in Test Observability
Learn how to upload attachments to tests in Test Observability.
You can upload various files as attachments to tests in Test Observability.
Attachments are needed in the following use cases:
- If your tests run outside the BrowserStack infrastructure, you might want to upload screenshots and other attachments to your tests to improve your Timeline Debugging experience.
- You might want to add DOM, HTML files, custom log-out files, etc. which are otherwise not captured by BrowserStack. These additional logs and information will improve your debugging experience.
You can view attachments under the Attachments tab in the Timeline Debugging view of a test.
How to upload attachments to tests
Currently, you can upload attachments for Java and Python frameworks. We will be adding this feature to other frameworks soon.
Upload attachments to Java tests
Test Observability supports attachments on Java-TestNG tests.
Add the following code to your Java tests to upload attachments:
Import the BrowserStack library
import com.browserstack.v2.utils.BrowserStack;
Upload files using the following method
String fileToUpload = "path/to/your/file.png";
BrowserStack.uploadAttachment(fileToUpload);
Here, fileToUpload
is a String variable with the path or link to the file you want to upload.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!