Skip to content

feat(testhub): generic testManagementOptions JSON input (SDK-7757) - #285

Open
rounak610 wants to merge 3 commits into
mainfrom
SDK-7757-issue-linking
Open

rounak610 wants to merge 3 commits into
mainfrom
SDK-7757-issue-linking

Conversation

@rounak610

@rounak610 rounak610 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

What is this about?

Customers can now pass any Test Management option to an automation run (first use: linking Jira issues to the Test Run, Q2 deal blocker) through one generic input, so new options need no SDK release:

  • browserstack.yml: the existing testManagementOptions: block
  • env: BROWSERSTACK_TEST_MANAGEMENT_OPTIONS='{"issues":["XYZ-1","XYZ-2"],"issueTracker":{"name":"jira","host":"https://demo.atlassian.net"}}'
  • CLI: --browserstack.testManagementOptions='<same json>'

The binary merges them per top-level key (CLI > env > yml) and sends the result unchanged on build start as test_management_options, next to the existing test_management.test_plan_id. The legacy BROWSERSTACK_TEST_PLAN_ID / --browserstack.testManagementOptions.testPlanId keep working and still win for testPlanId. Invalid or non-object JSON is ignored with a warning and never fails the build. Scope: frameworks whose build start goes through the binary.

WDIO changes (v9) (binary flow = Mocha and Cucumber, not multiremote). Env and CLI need no change, because the service forwards raw argv and the binary inherits env.

  • CLIUtils.getBinConfig rebuilt testManagementOptions with only testPlanId, so issues, issueTracker and any other key in the service options never reached the binary. The new getTestManagementOptions passes the object through as configured. It still trims testPlanId and drops it when blank, and omits the key when nothing is left.
  • TestManagementOptions allows any key and documents issues / issueTracker.
  • The service never exports BROWSERSTACK_TEST_PLAN_ID, so nothing to skip.

Tested

  • Unit: the existing cliUtils test that expected unknown testManagementOptions keys to be dropped now expects them to be kept. Build and tsc are clean.
  • E2E against BrowserStack, with the paired binary from source and build start captured with mitmproxy. Released 9.39.6 with the same config sent only {"testPlanId":"12345"}.
Scenario Runs Captured test_management_options / test_management.test_plan_id Result
service options: testPlanId 12345 + issues + issueTracker + customKey mocha v9, cucumber v9, mocha v8 all keys, testPlanId trimmed / 12345 pass
env JSON only mocha v9 env object / – pass
CLI JSON = mocha v9, cucumber v9, mocha v8 CLI object / 777 pass
CLI JSON space form mocha v9 CLI object / – pass
config + env + CLI mocha v9, mocha v8 (space form) per-key CLI > env > config / 111 pass
legacy --...testPlanId 12345 / =TP-1 mocha v9, cucumber v9 / 12345, TP-1 pass
BROWSERSTACK_TEST_PLAN_ID + env JSON testPlanId mocha v9 legacy wins / 999 pass
invalid env JSON + config mocha v9 config only; binary warns pass

Related Jira task/s

Release (mandatory for every PR — required for the ready-for-review label)

Version bump: (required — tick exactly one)

  • minor (backwards-compatible feature)
  • patch (bug fix or other small change)

Release notes type: (optional)

  • New Feature
  • Bug Fix
  • Other Improvement

Release notes (customer-facing): (optional but encouraged)

  • testManagementOptions set in the BrowserStack service options is now forwarded in full, so issues and issueTracker can link Jira issues to the build. The same JSON can be passed with the BROWSERSTACK_TEST_MANAGEMENT_OPTIONS environment variable or the --browserstack.testManagementOptions CLI argument (Mocha and Cucumber).

Release notes (internal): (required — engineer-facing; what actually changed / why)

  • getBinConfig forwards the whole testManagementOptions object to the binary (testPlanId still trimmed, dropped when blank); the env/CLI merge happens in browserstack-binary (SDK-7757).

Checklist

  • Ready to review
  • Has it been tested locally?

PR Validations

Run Tests: Comment RUN_TESTS to trigger sanity tests.

🤖 Generated with Claude Code

…-7757)

getBinConfig rebuilt testManagementOptions with testPlanId only, so issues,
issueTracker and any other key set in the service options never reached the
binary, which now sends the merged object as test_management_options at build
start. Pass the object through as configured, still trimming testPlanId and
dropping it when blank. Type issues and issueTracker and allow other keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rounak610
rounak610 requested a review from a team as a code owner October 14, 2026 12:07
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 99d4e95c-e536-42db-b1d3-ae5cd6006a7a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@rounak610

Copy link
Copy Markdown
Collaborator Author

RUN_TESTS

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@minionhelperappqa

Copy link
Copy Markdown

[SDK Wdio Test] TRA build state: passed | Stability 100% — verdict: success. Passed: 52, Failed: 0, Aggregate: 52. TRA: https://observability.browserstack.com/builds/4a28rw4xf6kynccbb3buyuyoluxm3qbbuqwsjcai

@rounak610

Copy link
Copy Markdown
Collaborator Author

✅ Good to go

File Confidence
.changeset/pr-285.md ✅ All Clear
packages/browserstack-service/src/cli/cliUtils.ts ✅ All Clear
packages/browserstack-service/src/types.ts ✅ All Clear
packages/browserstack-service/tests/cli/cliUtils.test.ts ✅ All Clear

Change map (generated deterministically from the diff)

graph LR
  subgraph nwdio_service["wdio-service"]
    npackages_browserstack_service_src_types_ts["types.ts<br/>~34 lines"]
    npackages_browserstack_service_src_cli_cliUtils_ts["cliUtils.ts<br/>~18 lines"]
    npackages_browserstack_service_tests_cli_cliUtils_test_ts["cliUtils.test.ts<br/>~18 lines"]
    n_changeset_pr_285_md["pr-285.md<br/>~5 lines"]
  end
Loading

↻ This verdict comment is the review anchor — it's updated in place on each run (the gate posts its status separately).

— SDK PR Review Agent

@github-actions

Copy link
Copy Markdown
Contributor

🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: success).

This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge.

@rounak610

Copy link
Copy Markdown
Collaborator Author

RUN_TESTS

@minionhelperappqa

Copy link
Copy Markdown

[SDK Wdio Test] TRA build state: failed | Stability 92% — verdict: failure. Passed: 49, Failed: 4, Aggregate: 53. TRA: https://observability.browserstack.com/builds/y5i7drvnjhqjft3xedystbge3etfmhoskk7rwhqa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants