Skip to main content
added 12 characters in body
Source Link
Robert Harvey
  • 200.1k
  • 55
  • 468
  • 679

canCreateNewUsers is an implementation detail for createUsers. Write your tests accordingly.

In other words, your unit tests for createNewUserscreateUsers should include some test cases that exercise the permissions function canCreateUserscanCreateNewUsers provides, within the context ofcreateUsers.

You don't have to write these additional tests if:

  1. You are already satisfied by the original unit tests that createUserscanCreateNewUsers functions properly, and
  2. You are already convinced that you are calling createUserscanCreateNewUsers properly so that it functions correctly in the context in which you are calling it.

But your fellow software developers aren't necessarily thinking about these things. Wouldn't it be nice if you had a test for createUsers that fails if someone else makes a change to canCreateNewUsers that breaks your code?

canCreateNewUsers is an implementation detail for createUsers. Write your tests accordingly.

In other words, your unit tests for createNewUsers should include some test cases that exercise the permissions function canCreateUsers provides.

You don't have to write these additional tests if:

  1. You are already satisfied by the original unit tests that createUsers functions properly, and
  2. You are already convinced that you are calling createUsers properly so that it functions correctly in the context in which you are calling it.

But your fellow software developers aren't necessarily thinking about these things. Wouldn't it be nice if you had a test for createUsers that fails if someone else makes a change to canCreateNewUsers that breaks your code?

canCreateNewUsers is an implementation detail for createUsers. Write your tests accordingly.

In other words, your unit tests for createUsers should include some test cases that exercise the permissions function canCreateNewUsers provides, within the context ofcreateUsers.

You don't have to write these additional tests if:

  1. You are already satisfied by the original unit tests that canCreateNewUsers functions properly, and
  2. You are already convinced that you are calling canCreateNewUsers properly so that it functions correctly in the context in which you are calling it.

But your fellow software developers aren't necessarily thinking about these things. Wouldn't it be nice if you had a test for createUsers that fails if someone else makes a change to canCreateNewUsers that breaks your code?

Source Link
Robert Harvey
  • 200.1k
  • 55
  • 468
  • 679

canCreateNewUsers is an implementation detail for createUsers. Write your tests accordingly.

In other words, your unit tests for createNewUsers should include some test cases that exercise the permissions function canCreateUsers provides.

You don't have to write these additional tests if:

  1. You are already satisfied by the original unit tests that createUsers functions properly, and
  2. You are already convinced that you are calling createUsers properly so that it functions correctly in the context in which you are calling it.

But your fellow software developers aren't necessarily thinking about these things. Wouldn't it be nice if you had a test for createUsers that fails if someone else makes a change to canCreateNewUsers that breaks your code?