Skip to content

docs: improve testing instructions#2965

Merged
opieter-aws merged 1 commit into
strands-agents:mainfrom
opieter-aws:opieter-aws/prefer-existing-test-assertions
Jun 25, 2026
Merged

docs: improve testing instructions#2965
opieter-aws merged 1 commit into
strands-agents:mainfrom
opieter-aws:opieter-aws/prefer-existing-test-assertions

Conversation

@opieter-aws

@opieter-aws opieter-aws commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

Agents adding coverage for a new behavior tend to write a brand-new unit test, duplicating the scenario setup, even when an existing test already arranges the same state and could simply carry one more assertion. This bloats the suite, multiplies expensive setup, and obscures intent.

Both SDK testing guides already lean this way — the TypeScript guide has a "Test Batching Strategy" section and the Python guide has assertion-granularity guidance — but neither states the rule plainly. This adds that guidance to both TESTING.md files, worded consistently and reusing each file's existing "when to keep a separate test" carve-out so the guides stay aligned.

In the TypeScript guide the rule is folded into the existing batching directive (reusing expensive setup is the same instinct) rather than added as a separate principle. In the Python guide it lands as the leading bullet of "Test Organization", since that file has no batching section to fold into.

Related Issues

Documentation PR

N/A — these are the SDK developer docs under strands-py/docs/ and strands-ts/docs/, not the published site under site/.

Type of Change

Documentation update

Testing

Docs-only change. Re-read both edited sections in context to confirm the wording reads naturally and the TypeScript cross-reference ("listed under 'You SHOULD keep separate tests for' below") still points at the right list. No build or test run applies to these Markdown files.

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@opieter-aws opieter-aws marked this pull request as ready for review June 25, 2026 17:38
@opieter-aws opieter-aws enabled auto-merge (squash) June 25, 2026 17:41
@github-actions github-actions Bot added strands-running size/xs documentation Documentation changes, improvements, additions, content updates, site improvements, examples, guides bug Something isn't working labels Jun 25, 2026
Comment thread strands-ts/docs/TESTING.md
@github-actions

Copy link
Copy Markdown
Contributor

Assessment: Approve

Focused, well-scoped docs change. It states a rule both guides only implied, the wording is consistent across the Python and TypeScript guides, and the forward reference to "You SHOULD keep separate tests for" resolves correctly (TS line 175). The carve-out for distinct behaviors / execution paths / error conditions is preserved in both files, so there's no risk of the new guidance encouraging over-batched, hard-to-debug tests.

Review notes
  • Accuracy: Cross-reference verified; Python "Test Organization" placement is sensible given there's no batching section to fold into.
  • Consistency: Both guides now carry the same intent and reuse their existing carve-outs — guides stay aligned.
  • Duplication: No pre-existing guidance restates this rule, so no redundancy introduced.
  • Style (non-blocking): One inline note on the TS **Rule**: line getting long — optional structural tweak.

Nice alignment improvement — this is exactly the kind of small, self-explanatory change that's easy to review and merge.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@opieter-aws opieter-aws merged commit 90cbef6 into strands-agents:main Jun 25, 2026
48 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Documentation changes, improvements, additions, content updates, site improvements, examples, guides size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants