Closed vorburger closed 7 years ago
I know it works fine when used with a forge mod, and I don't think it's possible to get minecraft classes as dependencies without ForgeGradle.
To be honest, LWTS is not really designed to be used for testing plugins using a specific implementation. While it will allow applying the necessary Mixins you still need to setup a full Minecraft workspace to be able to run your tests. You can use ForgeGradle to setup the decompiled Minecraft workspace. See https://cdn.rawgit.com/Spongy/SpongeDocs-PRs/f28a03e5/plugin/internals/index.html for some insights how to setup a MC workspace for a plugin.
The reality is, however, that there is no way to make it work without making your plugin indirectly depend on a MCP workspace. Using ForgeGradle you can only setup the MC sources as a compile dependency so you will always need to decompile when setting up your project and you will several implementation-dependent classes available for your plugin.
The other problem is that it requires you to copy several parts of the implementation (e.g. the names of the Mixin configurations). LWTS will only setup the environment, it won't handle initializing all Sponge services and registries which may be necessary to be able to test your plugin properly.
I'll close this for now. Let me know if you have more questions. :)
Hello @Minecrell, this project looks interesting! (FYI I had toyed with something vaguely related 1.5 yrs ago on http://blog2.vorburger.ch/2015/10/how-to-integration-test-minecraft.html, but not pursued it since.)
When attempting to use this for a POC to test a plugin (for developers with limited understanding of SpongePowered internals, Mixins and all; like myself), in something like my NewsServiceTest, with this TestTweaker, I'm getting about half way, currently failing with a lot of NPEs... perhaps you could advise what's missing to get something like this to work? I could contribute README documentation (or example project) how to test plugin with the LaunchWrapperTestSuite in return, if that would be of any value to this community.
From what little I understand, what the NPEs may really be trying to tell me could "just" be that I'm missing the (decompiled...) net.minecraft. and com.mojang. from the dependencies in the build.gradle ... but ... are those available as Maven artifacts? If they are not, how could one get them "dynamically" made available to such a test?
Thank you!