Test Plan for Item Component - UQcsse3200/2024-studio-3 GitHub Wiki

Overview

The ItemComponentTest class is responsible for unit testing the ItemComponent class, which represents an item entity in the game with properties such as itemName, itemType, and weight. The test case in this class ensures that the constructor initializes these properties correctly. The test goal is to ensure that the constructor of ItemComponent correctly initializes the component with the expected values for itemName, itemType, and weight.

Test Case

  1. ItemComponent Constructor Test
  • Objective: Validate that the ItemComponent constructor correctly assigns the values passed to it for the itemName, itemType, and weight attributes.
  • Testing Steps: Create an instance of ItemComponent with the correct attributes. Expected Result: All assertions should pass, confirming that the constructor correctly initializes the ItemComponent instance.
  1. Test Structure:
  • No specific setup is required. The test directly initializes an instance of ItemComponent in the test method.
  1. Individual Test Methods:
  • The test case is focused on validating the constructor, ensuring that each attribute is initialized correctly.
  1. Assertions:
  • The test uses assertEquals to validate the values of itemName, itemType, and weight against the expected values.