TEST: Let a property the client script populates have no value - #590
Conversation
The value type tests asked every available property for its value and its type. A property the 51Degrees client script populates, HasWebDriver for one, has no value at all on a request that carries no client script evidence, and these requests carry none, so asking for the type throws and the test fails with a key entitled to those properties. Both copies of the test now read whether there is a value first, check that the reason was given when there is none, and check the type when there is one. Checked against the live cloud with a key carrying HasWebDriver. Before the change ValueCloudTests reports one error, HasWebDriver has no value because the 51Degrees JavaScript that populates it has not run on this request, and after it the five tests pass.
Proven in CI, with one finding that is not about this branchFull build and test run on this branch: https://github.com/51Degrees/device-detection-java/actions/runs/35190312090 A draft pull request only runs the link lint, so the Pull Requests workflow was dispatched against this branch as a dry run to get real evidence. Nothing was merged, and the log shows why: with no pull request based on this branch the run builds the branch on its own as pull request 0, and the checkout and completion steps both print "Not running for a PR". All 20 jobs finished green, being 16 build and test jobs (Java 8, 11, 17 and 21 on Ubuntu and Windows, Java 8, 11, 17 and 21 on macOS x64, Java 11, 17 and 21 on macOS ARM, and Java 17 on Ubuntu ARM), the pull request lookup, the configure step, the performance comparison and the completion step. Reading the job logs rather than the conclusions, each job reports 9 Maven module summaries adding up to 100 tests run with 0 failures, 0 errors and 0 skipped, the same on every platform and every Java version. The findingSearching the logs for failure text rather than trusting the green ticks turns up one line that the job did not fail on: That is the Ubuntu ARM Java 17 job, and it is the only one of the 16. The other 15 jobs all run the same suite and report "Passed! - Failed: 0, Passed: 9" taking between 32 seconds and 1 minute 25. The ARM job fails all nine in 155 milliseconds, and every one of them carries the same cause: "Exec format error" means the file is a binary for another architecture, so this is the x64 Selenium Manager being launched on an ARM64 runner. It is a gap in what the Selenium package ships for linux-arm64 rather than anything in this branch, and no browser was ever started. It is worth raising separately, because the step does not fail the job, so the run looks green whilst nine tests are failing on that one platform. Nothing here touches what this pull request changes. The pull request has not been marked ready and no review has been requested. |
What is wrong
ValueTests.valueTypes, in both copies, walks every available property of theengine and calls
getValue()on it to check the type. A property the 51Degreesclient script populates has no value on a request that carries no client script
evidence, and the requests these tests make carry none, so
getValue()throwsand the test errors.
Against
https://cloud.51degrees.comwith a resource key entitled toHasWebDriver,device-detection.cloudreports:The test only passes today because the keys it usually runs with are not
entitled to those properties, so the failure is waiting for whichever key gains
one. The same shape of failure is what closed issue
#584, where the
data file gained
IsVisible,IsVisibleJavaScript,HasWebDriver,HasWebDriverJavaScriptandIsHeadlessand the on-premise tests broke.The change
Both copies of the test, the cloud one in
device-detection.cloud/src/test/java/fiftyone/devicedetection/cloud/ValueTests.javaand the shared one in
device-detection.shared/src/test/java/fiftyone/devicedetection/shared/testhelpers/data/ValueTests.java,now read
hasValue()first. Where there is no value the test checks that thereason was given, which is what a caller reads, and moves on. Where there is a
value the type check is unchanged. Nothing is skipped silently.
How it was checked
mvn -pl device-detection.cloud -am test -Dtest=ValueCloudTests,MissingPropertyHandlingTestswith
TestResourceKeyset to a key carryingHasWebDriver, on 17 September2026:
Tests run: 7, Failures: 0, Errors: 1, Skipped: 0, theerror being
ValueTests_Cloud_ValueTypesas quoted above;Tests run: 7, Failures: 0, Errors: 0, Skipped: 0.The on-premise copy is not exercised locally because the data file is not
available on this machine, so the CI run on this branch is what covers it.
The same change in the other repositories
ip-intelligence-java#178
makes the same change to that repository's
ValueTests.valueTypes, where thesame walk over every listed property hits a property the resource key is not
entitled to.
CI on this branch, 17 September 2026
The "Pull Requests" workflow was dispatched on this branch with
dryrun=true,which builds the branch and merges nothing. Run
35190312090
ran on
b0c0884, the head of this branch, and concluded success with all 20jobs green. In the
Ubuntu_Java_17job the Maven totals are 100 tests run, 0failures, 0 errors and 5 skipped, with no error lines in the log.
This branch is one commit behind
main, that commit being the automated packageupdate #591, and
it merges cleanly.
The nightly checks out the pull request, merges
maininto it and buildsthat before it merges anything, so the combination is tested there.