---
title: "Ship tests in the same change · Agent Wranglers"
url: https://agentwranglers.se/playbook/testing/test-strategy/tests-with-the-change
updated: 2026-10-20
licence: "All rights reserved"
---

# Ship tests in the same change

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Test strategy](https://agentwranglers.se/playbook/testing/test-strategy)
- Rule: Every change that adds or changes behaviour includes the tests for it. A bug fix starts with a test that fails before the fix.
- How: Write or update the test in the same pull request as the code. For a bug, first write a test that reproduces it and watch it fail. Then fix the code and watch it pass. Reviewers reject changes to behaviour that come without tests.
- Check: In review, revert the code change but keep the test. The new test fails. Restore the code, and it passes.

Example:

```python
# Bug: a cart with only free items charged a 5.00 shipping fee
def test_free_cart_has_no_shipping_fee():
    cart = Cart(items=[Item(price=0)])
    assert cart.shipping_fee() == 0
```

```ts
// Bug: a cart with only free items charged a 5.00 shipping fee
test('a free cart has no shipping fee', () => {
  const cart = new Cart([{ price: 0 }]);
  expect(cart.shippingFee()).toBe(0);
});
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers testing playbook: https://agentwranglers.se/playbook/testing/test-strategy/tests-with-the-change`.

- Previous: [Shape the test suite like a pyramid](https://agentwranglers.se/playbook/testing/test-strategy/test-shape)
- [Test strategy](https://agentwranglers.se/playbook/testing/test-strategy)
