Mindustry icon indicating copy to clipboard operation
Mindustry copied to clipboard

New functional test additions

Open dloe opened this issue 1 year ago • 0 comments

Adding new test cases aimed at capturing the main campaign game states, increasing testability, test coverage, and for adding tests verifying method execution through the use of mocking. This PR is test suite focused.

Inside DirectConsumerTests.java:

  • Added 2 partition tests for varying inputs for Power requests. Goal is to test more types of inputs to ensure proper efficiency noPowerRequestedWithNoItemsParameterized() noPowerRequestedSufficiencyParameterized()

Inside ApplicationTests.java

  • Added 5 functional tests to ensure proper game states during campaign game mode runSectorCaptured() runBossWave() wavesActiveStateTest() waveCountdownStateTest() gameOverStateTest()

  • Increased test coverage inside Logic.java with a new test case (more line, method and branch coverage) fogOfWarUpdateTest()

  • Increased test coverage inside ItemModule.java with 4 new test cases (increase in method, line and branch coverage) addingEntireTileContentsTile() itemModuleIDCoal() itemModuleByItemCoal() itemStackRemoveAndVerifyCheck()

  • Increased test coverage inside Turret.java with new test case testAmmoLoadingCap()

  • Increased test coverage inside Drill.java with 3 new test cases testDrillTypes() testDrillWithWater() testDrillOres()

  • Increased test coverage inside Distribution Package with 3 new test cases testDistributor() testUnloader() testOverflowGate()

  • Added test case to improve testability with testing of liquid flow. This test also uses 2 new methods inside Conduit.java and BuildingComp.java aimed at our dummy methods. Goal here is to have these methods simplify logic for the purpose of testability in relation to liquid flow systems. liquidJunctionOutputTestability()

  • Use of mocking to further test Logic execution, and Turret building. NOTE: Kinda worried about the Mockito package inclusion because it may be incompatible. May need clarification here. mockVerifyLogicGameStateReset() logicMockTest() mockTurretBuildVerification()

Also addition of more comments to touched methods inside DirectConsumerTests.java, and ApplicationTests,java

If your pull request is not translation or serverlist-related, read the list of requirements below and check each box:

  • [X] I have read the contribution guidelines.
  • [X] I have ensured that my code compiles, if applicable.
  • [X] I have ensured that any new features in this PR function correctly in-game, if applicable.

dloe avatar Sep 13 '24 01:09 dloe