-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
NMS independent test toolkit to allow developers to test their commands with MockBukkit #575
base: dev/dev
Are you sure you want to change the base?
Commits on Aug 22, 2024
-
Create
commandapi-bukkit-test-toolkit
Create `automated-tests-shaded` example project to test using the test toolkit Resolves #356 Alternative idea to current work on `dev/public-test-suite` Attempts to allow developers to test their commands independently of any version or nms stuff. Currently, most of the methods throw an UnimplementedMethodException, but I have implemented enough to get the simple `PingPongCommandTests` file to work as a proof of concept. TODO: - Implement the methods required to test: - `commandapi-bukkit-plugin` based projects - Common arguments - Suggestions - Write documentation - Maybe add a module to more rigorously test the toolkit without cluttering the example project I think if we can get a simple version working and published as a snapshot, users can try it out and identify methods that need to be implemented.
Configuration menu - View commit details
-
Copy full SHA for 2edad90 - Browse repository at this point
Copy the full SHA 2edad90View commit details -
Add
MockCommandAPIPlugin
for testing withcommandapi-bukkit-plugin
Add automated-tests example project for showing testing with `commandapi-bukkit-plugin` Remove unnecessary plugin constructors (it seems MockBukkit does not need them) Add MockCommandAPIPluginLoadingTests to thoroughly test loading options without cluttering example projects Fix some typos Fix some logging-based warnings
Configuration menu - View commit details
-
Copy full SHA for ce2c907 - Browse repository at this point
Copy the full SHA ce2c907View commit details -
Add
assertCommandSucceeds
andassertCommandFails
methods to Comma……ndAPITestUtilities Add DispatchCommandUtilitiesTests to fully test these methods Add CommandTestBase to provide utilities when testing the test toolkit Enable Jacoco code coverage report for `commandapi-test-toolkit` Add some comments
Configuration menu - View commit details
-
Copy full SHA for 313c299 - Browse repository at this point
Copy the full SHA 313c299View commit details -
Add
assertCommandRunsWithArguments
methods to CommandAPITestUtilitiesAdd CommandAPIHandlerSpy and ExecutionQueue to intercept and track command executions Add AssertArgumentUtilitiesTests and ExecutionQueueTests
Configuration menu - View commit details
-
Copy full SHA for ab04a99 - Browse repository at this point
Copy the full SHA ab04a99View commit details -
Implement testing IntegerRangeArgument NMS independently
Add IntegerRangeArgumentType to let Brigadier parse input to IntegerRange. Currently, the exceptions thrown are just their raw strings. I couldn't seem to get the translations keys `argument.range.empty` and `argument.range.swapped` to resolve due to MockBukkit/MockBukkit#1040. Implement Parser builder to make defining object parsers easier. Inspired by Brigadier command parse trees and #544. Add IntegerRangeArgumentTests
Configuration menu - View commit details
-
Copy full SHA for 1c604f9 - Browse repository at this point
Copy the full SHA 1c604f9View commit details -
Fix CommandAPIHandler javadoc error that breaks full build
e08a90a made `CommandAPIHandler#generateCommand` public instead of protected so CommandAPIHandlerSpy could intercept invocations. This promoted a javadoc warning into a javadoc error that stopped the build. Javadocs incorrectly indicated that `CommandAPIHandler#generateCommand` could throw a CommandSyntaxException, when it actually returns a lambda that could throw that exception (Brigadier's Command interface).
Configuration menu - View commit details
-
Copy full SHA for 8d10c62 - Browse repository at this point
Copy the full SHA 8d10c62View commit details -
Add
assertCommandSuggests
methods to CommandAPITestUtilitiesAdd AssertSuggestionUtilitiesTest Some tweaks to internal testing error messages
Configuration menu - View commit details
-
Copy full SHA for afc0bc6 - Browse repository at this point
Copy the full SHA afc0bc6View commit details -
Add
assertCommandFailsWithArguments
methodsAllows verifying the input to command executors when they end up throwing a WrapperCommandSyntaxException
Configuration menu - View commit details
-
Copy full SHA for 9e04b02 - Browse repository at this point
Copy the full SHA 9e04b02View commit details -
Improve coverage report by using Supplier<String> in CommandAPITestUt…
…ilities If the tests don't check the case where an assertion failed, the supplier won't run, so Jacoco can detect uncovered code. Cover and fix such a gap in `CommandAPITestUtilities#getExecutionInfo`
Configuration menu - View commit details
-
Copy full SHA for 5d8a164 - Browse repository at this point
Copy the full SHA 5d8a164View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e6d69c - Browse repository at this point
Copy the full SHA 6e6d69cView commit details -
Add EntitySelectorArgument, PlayerArgument, and OfflinePlayerArgument…
… to test toolkit I was initially going to just do PlayerArgument because I thought it would have simple suggestions. I then realized that OfflinePlayerArgument was basically the same argument, so I did that as well. The ProfileArgumentType is also basically half a EntitySelectorParser, so I did the EntitySelectorArgument as well, though selector options are currently left unimplemented. I wrote tests for all these, and that took a while. I still haven't implemented any ArgumentType suggestions code...
Configuration menu - View commit details
-
Copy full SHA for 29f5e66 - Browse repository at this point
Copy the full SHA 29f5e66View commit details -
Implement ArgumentType suggestions for test toolkit
I think the way I set up the Parser builder to support suggestions makes sense. It works at least. Parser now returns Result object, which tracks whether an object was returned or an exception was thrown, as well as a SuggestionProvider for the current location. Default methods added to Parser to handle this result appropriately when either parsing or suggesting. Moved Parser into its own package and extracted some of the inner classes and interfaces. Package-protected access accomplishes the same sort of encapsulation. Added methods to CommandAPITestUtilities to assert that suggestions are located at a specific offset index. Added tests~
Configuration menu - View commit details
-
Copy full SHA for e78f12f - Browse repository at this point
Copy the full SHA e78f12fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 122581d - Browse repository at this point
Copy the full SHA 122581dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2e102aa - Browse repository at this point
Copy the full SHA 2e102aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for f4663f5 - Browse repository at this point
Copy the full SHA f4663f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for e25ba25 - Browse repository at this point
Copy the full SHA e25ba25View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ee2fe0 - Browse repository at this point
Copy the full SHA 0ee2fe0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 525f12d - Browse repository at this point
Copy the full SHA 525f12dView commit details
Commits on Aug 24, 2024
-
Allow developers to load custom MockCommandAPIBukkit instances in the…
…ir tests This makes it possible to avoid UnimplementedMethodExceptions by overriding and implementing the method yourself NOTE: CommandAPIVersionHandler was changed from an interface to an abstract class so the test-toolkit version could have a non-final field. I don't think this affects anything else.
Configuration menu - View commit details
-
Copy full SHA for f71519e - Browse repository at this point
Copy the full SHA f71519eView commit details
Commits on Sep 23, 2024
-
Use translation keys instead of literal messages
Updated test toolkit's MockBukkit version to include MockBukkit/MockBukkit#1077, which allows accessing Minecraft Language codes. Moved utilities for creating mock argument parsers into ArgumentUtilities class. Made example project build script run maven tests, so the tests in the `automated-tests` and `automated-tests-shaded` example projects are run by GitHub Actions.
Configuration menu - View commit details
-
Copy full SHA for fd86f3d - Browse repository at this point
Copy the full SHA fd86f3dView commit details -
Configuration menu - View commit details
-
Copy full SHA for cd4adae - Browse repository at this point
Copy the full SHA cd4adaeView commit details -
Update MockBukkit-v1.21 to match paper updates
It seems that MockBukkit and Paper API need to match exactly. This seems a little annoying, because if something in Paper updates their API, a MockBukkit version can suddenly stop working, but you'll only realize once your local cached copy of paper-api updates.
Configuration menu - View commit details
-
Copy full SHA for 03d875f - Browse repository at this point
Copy the full SHA 03d875fView commit details
Commits on Oct 6, 2024
-
Add javadocs to ArgumentUtilities and parser package
Users may want to use these methods if they are trying to implement an ArgumentType that isn't currently provided by the test toolkit. This ideally also makes the Parser system understandable for developers who are not me :P.
Configuration menu - View commit details
-
Copy full SHA for 5ade948 - Browse repository at this point
Copy the full SHA 5ade948View commit details
Commits on Oct 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 051d88f - Browse repository at this point
Copy the full SHA 051d88fView commit details -
Missed this when 1.21 came out and added @n. Future idea: allow users to specify a version to account for behavior like this that changes by version. For now though, matching latest behavior makes sense.
Configuration menu - View commit details
-
Copy full SHA for a3e38e7 - Browse repository at this point
Copy the full SHA a3e38e7View commit details -
Add braces to inlined if-statements
Other one line if statements do have `{ }`, so these were inconsistent.
Configuration menu - View commit details
-
Copy full SHA for d7987b2 - Browse repository at this point
Copy the full SHA d7987b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0da49f1 - Browse repository at this point
Copy the full SHA 0da49f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 498d8e6 - Browse repository at this point
Copy the full SHA 498d8e6View commit details