Crafting System Testing Plan Sprint One - UQdeco2800/2022-studio-2 GitHub Wiki
Introduction
In this section, the components tested for sprint one will be discussed. The method used are:
- JUnit testing.
- Sonarcloud testing.
Junit Testing
Components tested
-
CraftingLogic.java
-
CraftingSystem.java
Details of testing methods implementations, please refer to https://github.com/UQdeco2800/2022-studio-2/wiki/Crafting-System-Code-Implementation-Sprint-One
Error One:
This test failed is due to wrong implementation of the testing method, failed to use AssertThat()
.
Error Two:
This test failed is due to misunderstanding of the method. It was:
Now:
@Test
void buildItemTest() {
CraftingSystem testCraftingSystem = new CraftingSystem();
testCraftingSystem.buildItem("Sword");
assertTrue(testCraftingSystem.getInventoryContents().contains(Materials.Wood)); // Wood is removed from the inventory after building a sword.
assertTrue(testCraftingSystem.getInventoryContents().contains(Materials.Steel)); // Steel is removed from the inventory after building a sword.
}
Turns out, the materials will always be reset in the inventory for sprint one, as explained by @Rohan