-
-
Notifications
You must be signed in to change notification settings - Fork 67
CommandAPI Bukkit testing matrix
Jorel Ali edited this page Jan 12, 2023
·
2 revisions
To test the CommandAPI for Bukkit, we have a matrix of tests in commandapi-platforms/commandapi-bukkit/commandapi-bukkit-test
.
The testing matrix structure is as follows:
commandapi-bukkit-test/
├── commandapi-bukkit-test-impl
├── commandapi-bukkit-test-impl-1.16.5
├── commandapi-bukkit-test-impl-1.17
├── commandapi-bukkit-test-impl-1.18
├── ...
├── commandapi-bukkit-test-tests
├── commandapi-bukkit-test-tests-1.16.5
├── commandapi-bukkit-test-tests-1.17
├── commandapi-bukkit-test-tests-1.18
├── ...
└── pom.xml
There are four primary components:
-
commandapi-bukkit-test-impl
. This is a collection of interfaces and templates for thecommandapi-bukkit-test-impl-a.b.c
modules -
commandapi-bukkit-test-impl-a.b.c
. This is an implementation ofMockNMS
, the primary wrapper forNMS
specific to Minecraft versiona.b.c
-
commandapi-bukkit-test-tests
. This is a collection of tests to run -
commandapi-bukkit-test-tests-a.b.c
. This is a collection of tests to run specific to Minecraft versionx.x.x
that would otherwise be unable to test incommandapi-bukkit-test-tests
Developer's Note:
At the time of writing (12th Jan 2023) The testing matrix is still in very early development!
commandapi-bukkit-test-impl
doesn't exist yet! For now, usecommandapi-bukkit-test-impl-1.19.2
.
-
commandapi-bukkit-test-tests
should be built against the lowest version of Minecraft (1.13) -
commandapi-bukkit-test-tests
should be run against all versions (1.13 - 1.19.3) using the variousMinecraft_a_b_c
profiles -
commandapi-bukkit-test-tests-a.b.c
should ONLY be run against versiona.b.c
-
commandapi-bukkit-test-tests-a.b.c
andcommandapi-bukkit-test-tests-d.e.f
may have overlapping tests. This is fine and should be the only place in the repo with copy/pasta all over the place
To figure out where this argument goes depends on the version (or versions) of Minecraft that this argument is compatible with. For arguments compatible with all Minecraft versions, start with commandapi-bukkit-test-impl
and commandapi-bukkit-test-tests
. Then follow these steps:
- Create a class
Argument<Name>Tests.java
indev.jorel.commandapi.test.arguments
. For example, aListArgument
test needs to be underArgumentListTests.java
. It's probably easier to copy an existing file, such asArgumentTimeTests.java
- Make sure your class extends
TestBase
- Declare your
setUp()
andtearDown()
methods and place those under aSetup
comment - Declare your
Tests
comment andSuggestion tests
comment
- Make sure your class extends
- Write your tests. Depending on the test type, follow these guidelines
For execution tests (testing the command runs):
- Declare them in a method
executionTestWith<Name>Argument()
- Declare one command per method
- Add
assertNoMoreResults(results)
at the end if you've usedMut<> results = Mut.of()
at the top
- Declare them in a method
suggestionTestWith<Name>Argument()