Skip to main content

I think you listed the differences very well in your question, however I'll add my some of my opinions on how I viewregarding the two approaches.

  • User-Level Requirement: Given the warehouse has at least N item(s) in inventory, when a user purchases N item(s), then the warehouse ships N item(s) to the user
  • System-Level Requirement 1: Given the inventory system has N item(s) in inventory, when a request for N item(s) is input into the inventory system then the inventory system decreases the inventory count for that type of item
  • System-Level Requirement 2: Given the payment system has N item(s) in inventory, when a request for N item(s) is input into the payment system then the payment system charges the user for N item(s)
  • ...
  • Programmer-Level Requirement 1: Given 5 sweaters are in inventory, when 3 sweaters are removed from inventory then 2 seaterssweaters are left in the inventory
  • ...

I think you listed the differences very well in your question, however I'll add my some of my opinions on how I view the two approaches.

  • User-Level Requirement: Given the warehouse has at least N item(s) in inventory, when a user purchases N item(s), then the warehouse ships N item(s) to the user
  • System-Level Requirement 1: Given the inventory system has N item(s) in inventory, when a request for N item(s) is input into the inventory system then the inventory system decreases the inventory count for that type of item
  • System-Level Requirement 2: Given the payment system has N item(s) in inventory, when a request for N item(s) is input into the payment system then the payment system charges the user for N item(s)
  • ...
  • Programmer-Level Requirement 1: Given 5 sweaters are in inventory, when 3 sweaters are removed from inventory then 2 seaters are left in the inventory
  • ...

I think you listed the differences very well in your question, however I'll add some of my opinions regarding the two approaches.

  • User-Level Requirement: Given the warehouse has at least N item(s) in inventory, when a user purchases N item(s), then the warehouse ships N item(s) to the user
  • System-Level Requirement 1: Given the inventory system has N item(s) in inventory, when a request for N item(s) is input into the inventory system then the inventory system decreases the inventory count for that type of item
  • System-Level Requirement 2: Given the payment system has N item(s) in inventory, when a request for N item(s) is input into the payment system then the payment system charges the user for N item(s)
  • ...
  • Programmer-Level Requirement 1: Given 5 sweaters are in inventory, when 3 sweaters are removed from inventory then 2 sweaters are left in the inventory
  • ...
fixing typo
Source Link
Frank Bryce
  • 968
  • 1
  • 6
  • 15
public void Test_CaseWhereThereAreEnoughSweatersLeft() {
    // Arrange
    // setup Sweater Inventory mock (DB mocks, etc)
    // count = 5
    // when The number of sweaters remaining is request, return count
    // when Inventory is requested to remove N items, then count = count - N
    
    // Act
    // call the Unit Under Test to remove 3 items from inventory
    
    // Assert
    // the number of sweaters in the inventory is 2
    // the removal should return indicating a successful removal of items from the inventory
}

public void Test_CaseWhereThereAreNotEnoughSweatersLeft() {
    // Arrange
    // setup Sweater Inventory mock (DB mocks, etc)
    // count = 2
    // when The number of sweaters remaining is request, return count
    // when Inventory is requested to remove N items, then count = count - N
    
    // Act
    // call the Unit Under Test to remove 3 items from inventory
    
    // Assert
    // the number of sweaters remaining is still 32
    // the removal should return an error indicating not enough items in the inventory
}
public void Test_CaseWhereThereAreEnoughSweatersLeft() {
    // Arrange
    // setup Sweater Inventory mock (DB mocks, etc)
    // count = 5
    // when The number of sweaters remaining is request, return count
    // when Inventory is requested to remove N items, then count = count - N
    
    // Act
    // call the Unit Under Test to remove 3 items from inventory
    
    // Assert
    // the number of sweaters in the inventory is 2
    // the removal should return indicating a successful removal of items from the inventory
}

public void Test_CaseWhereThereAreNotEnoughSweatersLeft() {
    // Arrange
    // setup Sweater Inventory mock (DB mocks, etc)
    // count = 2
    // when The number of sweaters remaining is request, return count
    // when Inventory is requested to remove N items, then count = count - N
    
    // Act
    // call the Unit Under Test to remove 3 items from inventory
    
    // Assert
    // the number of sweaters remaining is still 3
    // the removal should return an error indicating not enough items in the inventory
}
public void Test_CaseWhereThereAreEnoughSweatersLeft() {
    // Arrange
    // setup Sweater Inventory mock (DB mocks, etc)
    // count = 5
    // when The number of sweaters remaining is request, return count
    // when Inventory is requested to remove N items, then count = count - N
    
    // Act
    // call the Unit Under Test to remove 3 items from inventory
    
    // Assert
    // the number of sweaters in the inventory is 2
    // the removal should return indicating a successful removal of items from the inventory
}

public void Test_CaseWhereThereAreNotEnoughSweatersLeft() {
    // Arrange
    // setup Sweater Inventory mock (DB mocks, etc)
    // count = 2
    // when The number of sweaters remaining is request, return count
    // when Inventory is requested to remove N items, then count = count - N
    
    // Act
    // call the Unit Under Test to remove 3 items from inventory
    
    // Assert
    // the number of sweaters remaining is still 2
    // the removal should return an error indicating not enough items in the inventory
}

I think you listed the differences very well in your answerquestion, however I'll add my some of my opinions on how I view the two approaches.

I think you listed the differences very well in your answer, however I'll add my some of my opinions on how I view the two approaches.

I think you listed the differences very well in your question, however I'll add my some of my opinions on how I view the two approaches.

Source Link
Frank Bryce
  • 968
  • 1
  • 6
  • 15
Loading