Skip to content

Test Plan For MealComponent

Princess-Nx edited this page Aug 28, 2024 · 3 revisions

Test Environment

  • Framework: JUnit 5
  • Extension: GameExtension.class

Dependencies:

  • IngredientComponent
  • MealComponent
  • ItemType enum

Objective

The purpose of this test plan is to verify the functionality of the MealComponent class in the game. The test focuses on ensuring that the MealComponent is properly constructed and its properties, such as name, type, weight, ingredients, price, and quality, are correctly calculated.

Test Setup:

Ingredients Setup: Three IngredientComponent instances are created to simulate different types of ingredients used in meals:

  • Tomato: Raw state with specific quality attributes.
  • Cucumber: Cooked state with specific quality attributes.
  • Beef: Burnt state with specific quality attributes.

Test Cases:

Test Case: MealComponent Constructor Test Purpose: Verify that the MealComponent is properly constructed with the correct name, type, weight, list of ingredients, price, and calculated quality. Setup: Create a list of three ingredients (Tomato, Cucumber, Beef) and use them to construct a MealComponent representing a "steakMeal."

Assertions:

  • Assert that the meal name is set correctly to "steakMeal".
  • Assert that the item type is ItemType.STEAKMEAL.
  • Assert that the weight of the meal is correctly set to 32.
  • Assert that the list of ingredients matches the expected list (Tomato, Cucumber, Beef).
  • Assert that the price is correctly set to 20.
  • Assert that the calculated quality of the meal is correct (33).

Expected Outcome:

The test should pass if the MealComponent constructor correctly initializes all the fields based on the provided ingredients and the meal's attributes.

Test Coverage:

The test primarily covers the constructor and getters for MealComponent. The calculation of quality based on ingredient states (raw, cooked, burnt) is also indirectly verified.

This test plan ensures that the MealComponent constructor works as expected and that the class properties are initialized and calculated correctly. Additional test cases can be added to cover more complex scenarios and edge cases.

Table of Contents

Home

Team Design Document

Game Features

Inventory System
Scoring System
Food Recipes
Level System
Player Actions
Ordering System
Stations
Items
Map Design
Customers
Pause Menu
Upgrades
End of Day Display
Day Night Cycle
Moral System
Debug Terminal
Game Interactions Tutorial
Backstory Cutscenes

Game

Getting Started

Entities and Components

World Backstory

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Map Design

Test Plans

Sensor Component

Customer Sensor Component

Interaction Component

Inventory Component

Inventory Display

Station Meal Component

Station Progress Display

Keyboard Input Component

Fire Extinguisher Handler Component

Score System

HoverBox Component

MainGameActions Create Docket Triggers

End Day Display Component

Cutscene Area

Docket

Docket Line Display

Docket Meal Display

Main Game Order Button Display

Order Actions

Recipe

Ticket Details Component

BackstoryCutscene Test Plan

BackstoryCutsceneDisplay Test Plan

Test Plan for Tutorial

Keybinds

Keybinds Test Plan

Test Plan for MainGameOrderTicketDisplay

Test Plan for MainGameOrderBtnDisplay

Test Plan for Docket

Test Plan for DocketLineDisplay

Test Plan for OrderActions

Ticket Details

Test plan for RandomComboService

Test plan for LoanUpgrade

Test plan for UpgradesDisplay

Test plan for RageUpgrade

Test plan for SpeedBoostUpgrade

Test plan for DancePartyUpgrade

Test plan for ExtortionUpgrade

Troubleshooting

MacOS Setup Guide

Clone this wiki locally