feat(test): add PropertyTestHelper trait for property-based tests#419
Merged
kjonescertinia merged 2 commits intomainfrom Jan 25, 2026
Merged
feat(test): add PropertyTestHelper trait for property-based tests#419kjonescertinia merged 2 commits intomainfrom
kjonescertinia merged 2 commits intomainfrom
Conversation
Add infrastructure for property-based testing: - PropertyTestHelper trait combining ScalaCheck with existing TestHelper - IdentifierPropertyTest demonstrating property testing on identifier validation The property tests verify identifier validation rules: - Valid identifiers (alphanumeric + underscore, proper structure) - Invalid patterns (leading/trailing underscore, leading digit, double underscore, illegal chars) Note: Uses _root_ prefix to avoid naming conflict with apex-ls's own org package. Closes #411 Closes #412
4cc7485 to
923a11a
Compare
- Add fuzzing test that verifies arbitrary strings are handled consistently with the identifier validation spec - Configure 250 test cases per property for thorough coverage - Add doc/PropertyTesting.md with guidance on when and how to use property-based testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Add infrastructure for property-based testing and demonstrate with identifier validation tests.
Changes
PropertyTestHelper trait (
jvm/src/test/scala/com/nawforce/apexlink/)ScalaCheckPropertyCheckswith existingTestHelper_root_prefix to avoid naming conflict with apex-ls'sorgpackageIdentifierPropertyTest (
shared/src/test/scala/com/nawforce/pkgforce/names/)Property Tests Added
valid identifiers are accepted- generates valid patterns, verifies acceptanceidentifiers starting with underscore are rejectedidentifiers ending with underscore are rejectedidentifiers starting with digit are rejectedidentifiers containing double underscore are rejectedidentifiers containing illegal characters are rejectedsingle letter identifiers are validsingle digit identifiers are invalidTest plan
sbt apexlsJVM/Test/compilesucceedssbt apexlsJVM/testOnly com.nawforce.pkgforce.names.IdentifierPropertyTest- all 8 property tests passsbt apexlsJVM/test- all 2517 tests passCloses #411
Closes #412
🤖 Generated with Claude Code