Title: test: fix pre-existing unit-test failures (green the suite) by 07souravkunda · Pull Request #100 · browserstack/browserstack-local-java · GitHub
Open Graph Title: test: fix pre-existing unit-test failures (green the suite) by 07souravkunda · Pull Request #100 · browserstack/browserstack-local-java
X Title: test: fix pre-existing unit-test failures (green the suite) by 07souravkunda · Pull Request #100 · browserstack/browserstack-local-java
Description: What was failing On a clean checkout of master, mvn -q -B test reported 2 errors out of 14 tests: testIsRunning testMultipleBinary Both threw a NullPointerException from ProcessBuilder.start() (via Local.runCommand) whenever BROWSERSTACK_ACCESS_KEY was not set in the environment. These two tests start a real BrowserStack Local tunnel, so the access key is read from the environment and appended to the binary command. With no key, a null element lands in the command list and ProcessBuilder.start() rejects it — the failure happens before any assertion runs. The other 12 tests only build the command string (onlyCommand=true) and pass regardless. This means every clean run without credentials (local dev, forks, CI without secrets) starts red, forcing anyone touching the repo to first confirm the failures pre-date their change. What this fixes testIsRunning and testMultipleBinary are integration tests that genuinely require credentials. Guarded each with a JUnit assumeNotNull(System.getenv("BROWSERSTACK_ACCESS_KEY")) so they skip gracefully when no key is present, while still running the full assertions whenever a key is available (e.g. CI with secrets). No assertion is weakened, disabled, or removed. Scope is limited to the test file. Verified with BROWSERSTACK_ACCESS_KEY set: testIsRunning runs and passes end-to-end (real tunnel up → isRunning() true). What is left red Nothing masks a product bug. One note for maintainers: when a valid key is present, testMultipleBinary can still fail intermittently at its first start() with "Either another browserstack local client is running ... port 45691". This is a test-isolation issue — the tunnel from the preceding testIsRunning has not released the fixed default port before this test opens its own on the same port. It is a harness-ordering problem, not a product defect (the binary correctly refuses a duplicate tunnel), and it is out of scope for this credential-less baseline fix. A follow-up could isolate the live tests with unique local identifiers / port cleanup. How to run the suite mvn -q -B test Without BROWSERSTACK_ACCESS_KEY: 12 tests run, the 2 live tunnel tests are skipped → green. With a valid BROWSERSTACK_ACCESS_KEY exported: the live tests execute against a real tunnel.
Open Graph Description: What was failing On a clean checkout of master, mvn -q -B test reported 2 errors out of 14 tests: testIsRunning testMultipleBinary Both threw a NullPointerException from ProcessBuilder.start() (v...
X Description: What was failing On a clean checkout of master, mvn -q -B test reported 2 errors out of 14 tests: testIsRunning testMultipleBinary Both threw a NullPointerException from ProcessBuilder.start() (v...
Opengraph URL: https://github.com/browserstack/browserstack-local-java/pull/100
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:0aa8b7c3-f7aa-d858-7f26-f939b4bfd891 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E848:245336:C57D6E:10C55BE:6B048B9D |
| html-safe-nonce | f810e05e27db4e89519ae5de1eaa0cef8e9deef16b79ac6a757c6cc405f6ac3f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODQ4OjI0NTMzNjpDNTdENkU6MTBDNTVCRTo2QjA0OEI5RCIsInZpc2l0b3JfaWQiOiI3ODUyNjY3MDU3NTg5MjI2Mzk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a0dbbf6d8e8ef4e2fd51338e04de16c5bd8436f42e7ab25a626dbace1be621fd |
| hovercard-subject-tag | pull_request:4229996549 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/browserstack/browserstack-local-java/pull/100/files |
| twitter:image | https://avatars.githubusercontent.com/u/50537259?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/50537259?s=400&v=4 |
| og:image:alt | What was failing On a clean checkout of master, mvn -q -B test reported 2 errors out of 14 tests: testIsRunning testMultipleBinary Both threw a NullPointerException from ProcessBuilder.start() (v... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9b297275a74a2c9a35898175c9477837c635d4f579277ebff3b2d6ebd012e247 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/browserstack/browserstack-local-java git https://github.com/browserstack/browserstack-local-java.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 51923142 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-local-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 51923142 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-local-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b51ce57ca6d4565a42856fc1c9897077c794597f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width