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

[API-10] Improve unit tests #3873

Open
wants to merge 19 commits into
base: api-10
Choose a base branch
from

Conversation

Yeregorix
Copy link
Member

@Yeregorix Yeregorix commented Jul 7, 2023

Continuing from #3815.

This PR adds the ability to run JUnit 5 tests in a ModLauncher context where Sponge and a DedicatedServer is initialized (but not ticking). This is done using modlauncher-injector-junit the successor of LaunchWrapperTestSuite.

I also added JaCoCo so we can measure code coverage. This should help us improve the test suite in the future.

Some of the launch logic is shared between SpongeVanilla and Sponge.test. Sponge.test is depending on SpongeVanilla.launch and SpongeVanilla.applaunch-base

The only issues identified so far with this setup are:

  • @ParameterizedTest cannot be executed in a ModLauncher context. However @TestFactory is a wonderful alternative and is working perfectly.
  • All unit tests are running in the same ModLauncher context. Any value registered into Sponge by a test should be unregistered after the test so it doesn't interfere with other tests. In the future, using a custom class loader might be a solution to create multiple isolated ModLauncher instances. It's not planned at the moment, because we don't need it.

I have updated all tests in the invalid/ directory.

Some tests are failing and need fixes but this it out of the scope of this PR, so these tests are currently @Disabled. Anyone willing to fix the implementation to make pass these tests is welcome.

@ImMorpheus ImMorpheus requested review from gabizou and removed request for gabizou November 3, 2023 20:36
@ImMorpheus ImMorpheus added the version: 1.19 API: 10 label Nov 3, 2023
@gabizou gabizou force-pushed the api-10 branch 2 times, most recently from 5825843 to 1c4ba14 Compare January 16, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants