Item Bar System Testing Plan - UQdeco2800/2021-ext-studio-2 GitHub Wiki

Sprint 3

Considering it is hard to test whether an item was picked up or used because of its visual nature, the tests were made to check the capacity of item bar

newItembarTest.java


    @Test
    void addwater() {
        newItembar bar = spy(newItembar.class);
        for (int i = 0; i < 8; i++) {
            bar.addwater();
        }
        assertEquals(10,bar.getwater());
    }

    @Test
    void addfood() {
        newItembar bar = spy(newItembar.class);
        for (int i = 0; i < 8; i++) {
            bar.addfood();
        }
        assertEquals(10,bar.getfood());
    }

    @Test
    void addkit() {
        newItembar bar = spy(newItembar.class);
        for (int i = 0; i < 8; i++) {
            bar.addkit();
        }
        assertEquals(10,bar.getkit());
    }

Things can be tested in game play

  1. pick up kits
  2. press K to use water, will increase water image on water system by 1
  3. press J to use kit, will increase health by 10
  4. press L to use food, will increase food image on food system by 1