Test Plan for StationCookingComponent - UQcsse3200/2024-studio-3 GitHub Wiki

The purpose of this plan is to test the basic functionality of the cooking component.

Test Environment

  • Framework: JUnit4
  • Objects Used: Oven, Stove

Test Cases - Testing CookingComponent

Start Ingredient Cooking

Purpose:

The purpose of this test is to verify that the StationCookingComponent correctly starts cooking the ingredient when the appropriate event is triggered.

Test Method:

IngredientStartsCooking()

Expected Outcome:

When the 'Cook Ingredient' event is triggered, the ingredient's CookIngredientComponent should have its isCooking property set to true.

Starting and Stopping Ingredient Cooking

Purpose:

The purpose of this test is to verify that the StationCookingComponent correctly starts and stops the cooking process based on triggered events.

Test Method:

IngredientStartsCookingThenStops()

Expected Outcomes:

  • After triggering the 'Cook Ingredient' event, the ingredient should start cooking and getIsCooking() should return true.
  • After triggering the 'Stop cooking ingredient' event, the ingredient should stop cooking and getIsCooking() should return false.

Test Ingredient Cooks

Purpose:

The purpose of this test is to verify that the ingredient cooks correctly over time.

Test Method:

TestIngredientCooks()

Expected Outcome:

  • When cooking is initiated and time progresses, the ingredient should eventually reach the cooked state. The cookItem() method on the IngredientComponent should be called, and the ingredient should remain in a cooked state.

Test Ingredient Burns

Purpose:

The purpose of this test is to verify that the ingredient burns after being left to cook over a specified amount of time.

Test Method:

TestIngredientBurns()

Expected Outcome:

  • If the cooking time exceeds the allowed limit, the ingredient should burn. The burnItem() method on the IngredientComponent should be called, and the isCooking property should be set to false.

Test Ingredient Cooks Then Burns

Purpose:

The purpose of this test is to verify that the ingredient cooks first, and then burns if cooking has not been stopped in time.

Test Method:

TestIngredientCooksThenBurns()

Expected Outcome:

  • Initially the ingredient should cook properly, triggering the cookItem() method. If cooking continues for too long, the burnItem() method should be called, and cooking should stop with isCooking set to false.

Test Cooks But Does Not Burn When Stopped

Purpose:

The purpose of this test is to verify that the ingredient stops cooking before it burning if the 'Stop Cooking Ingredient' event is triggered.

Test Method:

TestIngredientDoesntBurn()

Expected Outcome:

  • The ingredient should cook properly, and when the 'Stop Cooking Ingredient' event is triggered before it burns, the burnItem() method should not be called. Cooking should stop, and isCooking should be set to false.