Implement text file input for tests #2775
Closed
+258
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Thanks for taking the time to fill out this pull request!
Issue Reference
Please link to any related issues
Changes
Please describe the changes proposed in this pull request
This PR introduces the ability to load string parameter values for BAML tests directly from external text files.
Key changes include:
args { param { file "path/to/file.txt" } }is now supported forstringtype parameters.file, aligning with existing media type handling.test.mdxto reflect the new functionality.This feature is particularly useful for managing long text inputs, improving test organization, and reusing test data.
Testing
Please describe how you tested these changes
test_file_as_string: Basic file reading with an absolute path.test_file_as_string_relative_path: Correct resolution of relative file paths.test_file_as_string_missing_file: Proper error handling for non-existent files.local development environmentScreenshots
If applicable, add screenshots to help explain your changes
[Add screenshots here...]
PR Checklist
Please ensure you've completed these items
Additional Notes
Add any other context about the PR here
This change addresses the need for a more flexible way to provide string inputs to BAML tests, especially for large or frequently updated content. The approach leverages existing patterns for handling media files to ensure consistency and avoid ambiguity with struct definitions.
Slack Thread