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

Add game and junit tests to AP #562

Draft
wants to merge 72 commits into
base: dev/1.19.2
Choose a base branch
from
Draft

Add game and junit tests to AP #562

wants to merge 72 commits into from

Conversation

SirEndii
Copy link
Member

@SirEndii SirEndii commented Feb 23, 2024

This PR aims to add the long needed game tests to AP. It's still a draft.
We will use the Testing Framework from CC to accomplish this
The framework is implemented, and I started to work on the first tests

  • Checklist
  • - Add JUnit tests for common AP functions
  • - Mod Integrations
      • - Botania
      • - AE 2
      • - Note Blocks
      • - Beacons
      • - RS (currently not possible)
      • - Create
      • - Mekanism
      • - Powah
      • - Minecolonies (currently not possible)
  • - Peripherals
      • - Environment Detector
      • - Chat Box
      • - Player Detector
      • - Energy Detector
      • - Inventory Manager
      • - Redstone Integrator
      • - Block Reader
      • - Geo Scanner
      • - NBT Storage
  • - Turtles
      • - Chatty
      • - Chunky (Not possible to test)
      • - Compass
      • - Player Detector
      • - Environment Detector
      • - Geo
      • - Weak Automata
      • - OP Weak Automata
      • - Husbandry Automata
      • - OP Husbandry Automata
      • - End Automata
      • - OP End Automata
  • - Pocket Computers (?) Currently not possible without an entity that loads the pocket
      • - Chatty
      • - Player Detector
      • - Enviroment
      • - Geo
  • - Documentation

ToDos:

  • The Geo Scanner docs list a getScanCooldown method which currently does not exist in AP, so I cannot test it (the test currently uses the "internal" getOperationCooldown("scanBlocks") method)
  • The isOnEnchantedSoil function on Botania Mana Flowers always returns false, even when the flower is placed on enchanted soil. This seems to be the case because the overgrowth variable on a Mana Flower is only set to true during the flower tick (see https://github.com/VazkiiMods/Botania/blob/1.20.x/Xplat/src/main/java/vazkii/botania/api/block_entity/SpecialFlowerBlockEntity.java#L100)
  • The isEmpty method on Botania Mana Pools is currently missing
  • For the Botania Mod Integration, some methods are only available in the 1.20.1 versions of AP, so they're currently commented out in the .lua test files. When merging this to the 1.20.1 branch, these methods should be uncommented
  • Botania Mana Spreaders have a getBounding method returning the coordinates of the block that the spreader is directed towards, shouldn't it be called getBinding then?
  • The isEmpty function on Botania Mana Spreaders does not return if the mana in the spreader is empty but if the item handler of the spreader is empty
  • On Note Blocks, the method changeNoteBy is named somewhat weird. It sets the note value to the given parameter and does not change the note by x amount. Shouldn't it be called setNote or something?

…s to code test the most code which does not need a running minecraft instance. For other parts of the project, gametests will be created at a later point

Also make a static helper function to create the tooltips to minimize duplication and maintenance time
# Conflicts:
#	gradle.properties
# Conflicts:
#	src/main/java/de/srendi/advancedperipherals/common/items/base/BaseBlockItem.java
#	src/main/java/de/srendi/advancedperipherals/common/items/base/BaseItem.java
…uters with CC's testing api

Removed some old stuff
@SirEndii
Copy link
Member Author

I will mark this as high priority. I will work on this asap since we really need tests for AP

@SirEndii SirEndii added Priority-High help wanted Some help is needed labels Apr 30, 2024
@SirEndii
Copy link
Member Author

SirEndii commented May 2, 2024

I've implemented (copied) the needed stuff from the test source sets, but there is currently another issue with hamcrest and junit I need to work on
I'm going to fix this asap. For now there are the cc tests in AP for testing purposes

@SirEndii
Copy link
Member Author

SirEndii commented May 3, 2024

I fixed everything that need to be fixed (I think)
The game tests are now ready to be created

build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated Show resolved Hide resolved
The test can be run via `runGameTestClient` using the /test command or `runGameTestServer` to run all the tests automatically
dogboy21 and others added 18 commits May 21, 2024 16:27
Implement game tests for more peripherals
…l-tests

Revert "Implement game tests for more peripherals"
…2-peripheral-tests

Revert "Revert "Implement game tests for more peripherals""
… the 1.20.x branch

This was mainly done to allow the execution of client tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

3 participants