Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New functional test additions #10200

Closed
wants to merge 61 commits into from
Closed

New functional test additions #10200

wants to merge 61 commits into from

Conversation

dloe
Copy link

@dloe dloe commented Sep 13, 2024

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:

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

dloe and others added 30 commits February 4, 2024 10:01
ran tests on noPowerRequestedWithNoItemsParameterized to get data to write about on our assignment 1 doc.
- Added more comments to parameterized tests testing power requests
pushing the completed verification that SectorCapturedStateTest() confirms we have captured a sector in a game of Mindustry
- One goes down fog of war logic in logic.java
- one expands on hitting other method coverage in ItemModule.java (blocKInventories)
added damage building. building damage test now passes :D
ammo is kept track in the tile and not the turret itself. i made a building test object to access the current ammo of the turret and used that to compare to a turret variable named compareTo.
added an assert before loading ammo into turret to show it is created with 0 ammo
soorMSWE and others added 28 commits March 1, 2024 15:30
im not sure if this is what we need but it improves testing on Block.java
Found better testability test instead with flow
Updated some formatting and comments.
@Anuken
Copy link
Owner

Anuken commented Feb 10, 2025

Unfortunately, I will have to reject this PR. Some of the tests are questionable, while others don't fit the style guidelines or perform redundant operations. It would take more time to sort this out than to write my own tests.

Various issues I found:

  • You're adding code to non-test classes, which I don't think is acceptable. Use reflection if necessary.
  • Adding a dummy update method to conduits defeats the entire point of testing conduits to begin with.
  • System.out.println usage in runSectorCaptured
  • Newline braces in some parts, incorrect/inconsistent formatting in others
  • Redundant checks for boss waves (already included in the current tests)
  • Multiple instances of tests that will loop infinitely instead of failing, leading to very serious CI problems
  • Redundant tests like fogOfWarUpdateTest that don't verify anything meaningful

@Anuken Anuken closed this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants