Terasology icon indicating copy to clipboard operation
Terasology copied to clipboard

Refactor `UseWorldGenerator` and `Dependencies` annotations in Module Land

Open jdrueckert opened this issue 2 years ago • 8 comments

In the aftermath of https://github.com/MovingBlocks/Terasology/pull/5046 reworking the test annotations for MTE, the UseWorldGenerator and Dependencies annotations need to be replaced all across module land.

Migration Path

The replacement annotation is the class annotation @IntegrationEnvironment which will apply MTEExtension, mark it with an MteTest JUnit tag and includes parameters for world generation and module dependencies. The worldGenerator parameter is replacing @UseWorldGenerator, the dependencies parameter is replacing @Dependencies.

Contributes to https://github.com/Terasology/ModuleTestingEnvironment/issues/76

jdrueckert avatar Dec 17 '22 21:12 jdrueckert

Module land usages of @UseWorldGenerator:

  • [x] DynamicCities::SettlementEntityManagerTest
  • [x] ItemPipes::ItemPipesTest
  • [x] SimpleFarming::BushAuthoritySystemTest
  • [x] SimpleFarming::PlantAuthoritySystemTest

Module land usages of @Dependencies:

  • [x] Behaviors::BehaviorTests
  • [x] Behaviors::MovementTests
  • [x] DynamicCities::RegionEntitiesTest
  • [x] DynamicCities::SettlementEntityManagerTest
  • [x] Health::BlockTest
  • [x] Health::DamageEventTest
  • [x] Health::RestorationTest
  • [x] Health::RegenTest
  • [x] ItemPipes::ItemPipesTest
  • [x] NameGenerator::CreatureNameGeneratorSystemTest
  • [x] NameGenerator::CreatureNameProviderTest
  • [x] NameGenerator::RegionNameProviderTest
  • [x] NameGenerator::TownNameProviderTest
  • [x] NameGenerator::WaterNameProviderTest
  • [x] Rails:RailsTest
  • [x] SimpleFarming::BushAuthoritySystemTest
  • [x] SimpleFarming::PlantAuthoritySystemTest
  • [x] Tasks::TaskGraphTypeHandlerTest

No additional module land usages of @Tag("MteTest") and @ExtendWith(MTEExtension.class) that were not yet listed above.

jdrueckert avatar Dec 18 '22 13:12 jdrueckert

Hi, I am new to the project and I would like to work on a few simple tasks to familiarize myself with the project. I could at least do some of the refactoring of the annotations.

For the file "PlantAuthoritySystemTest.java" of the "SimpleFarming" module, would you have to replace the lines

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.extension.ExtendWith;
import org.terasology.engine.integrationenvironment.jupiter.Dependencies;
import org.terasology.engine.integrationenvironment.jupiter.UseWorldGenerator;

...

@ExtendWith(MTEExtension.class)
@UseWorldGenerator("unittest:empty")
@Dependencies({"SimpleFarming", "CoreAssets"})
@Tag("MteTest")

with these here

import org.terasology.engine.integrationenvironment.jupiter.IntegrationEnvironment;

...

@IntegrationEnvironment(dependencies={"SimpleFarming", "CoreAssets"}, worldGenerator="unittest:empty")

?

F14V10 avatar Nov 19 '23 15:11 F14V10

@Sabo2k @F14V10 That's exactly what we have pull request reviews for :wink: Yes, your proposed changes are correct. In the future, please open a PR proposing them and in our review, we'll tell you if there's anything that doesn't look alright :slightly_smiling_face:

jdrueckert avatar Nov 19 '23 21:11 jdrueckert

I did the same changes last night, right now going through the PR process just to learn it

varangian-core avatar Nov 19 '23 21:11 varangian-core

There's enough modules for which changes are needed, so I'm looking forward to PRs from all of you 😉

jdrueckert avatar Nov 24 '23 19:11 jdrueckert

Hey! how can I contribute on this one?

manumafe98 avatar Dec 27 '23 03:12 manumafe98

Hi @manumafe98, basically follow the issue description. for an example of expected changes, you can also have a look at F14V10's comment above. If you're new to Terasology, check out our getting started website page and guide doc

jdrueckert avatar Jan 03 '24 19:01 jdrueckert

Thanks @jdrueckert I will give it a try!

manumafe98 avatar Jan 03 '24 19:01 manumafe98

All sub-items done 💚

jdrueckert avatar Feb 25 '24 19:02 jdrueckert