alcatrazescapee / mcjunitlib Goto Github PK
View Code? Open in Web Editor NEWA library that makes it possible to use JUnit tests with Minecraft Forge mods without fear of class loading order.
License: MIT License
A library that makes it possible to use JUnit tests with Minecraft Forge mods without fear of class loading order.
License: MIT License
Hello Again.
So I decided to drop to version of 1.16.5 to be able to use the 1.16 of the library but I'm having issues when running the build.gradle
I downloaded version 1.16.5-36.2.27 of the MDK and the error I get:
"Apply build file "build.gradle" to root project 'forge-1.16.5-36.2.27-mdk" shows a RED circle
The line that seems to be causing it is the testImplementation fg.deobf here:
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
testImplementation fg.deobf('com.github.alcatrazEscapee:mcjunitlib:1.16.5_1.4.4')
}
Any suggestions? Also should I be using a specific MDK?
Thanks so much.
Hey,
I tried to setup your nice test lib in my environment. I followed the steps of the readme and add 2 tests for testing your lib.
Everytime I start the test server, I get this log:
[20:34:48] [main/UNITTEST] [co.al.mc.DedicatedTestServerLauncher/]: TestServerLauncher Starting
[20:34:48] [main/UNITTEST] [co.al.mc.DedicatedTestServerLauncher/]: Launching Launcher with arguments: --crashOnFailedTests, --gameDir, ., --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 36.0.4, --launchTarget, fmltestserver
[20:34:50] [main/UNITTEST] [co.al.mc.TestMain/]: TestMain launching
[20:34:59] [main/UNITTEST] [co.al.mc.TestMain/]: Removing previous test world...
[20:35:06] [main/UNITTEST] [co.al.mc.TestMain/]: Setting random seed: 6762956184618966637
[20:35:06] [Server thread/UNITTEST] [co.al.mc.DedicatedTestServer/]: Server Thread Starting
[20:35:13] [Server thread/UNITTEST] [UnitTests/]: Did not discover any tests to run.
[20:35:13] [Server thread/UNITTEST] [co.al.mc.DedicatedTestServer/]: Encountered an unexpected exception
java.lang.BootstrapMethodError: java.lang.IllegalAccessError: tried to access method net.minecraft.server.MinecraftServer.isAheadOfTime()Z from class com.alcatrazescapee.mcjunitlib.DedicatedTestServer
at com.alcatrazescapee.mcjunitlib.DedicatedTestServer.func_240802_v_(DedicatedTestServer.java:148) ~[?:1.4.1-1.16.5] {re:classloading}
at net.minecraft.server.MinecraftServer.lambda$startServer$0(MinecraftServer.java:233) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162] {}
Caused by: java.lang.IllegalAccessError: tried to access method net.minecraft.server.MinecraftServer.isAheadOfTime()Z from class com.alcatrazescapee.mcjunitlib.DedicatedTestServer
at java.lang.invoke.MethodHandleNatives.resolve(Native Method) ~[?:1.8.0_162] {}
at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:975) ~[?:1.8.0_162] {}
at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1000) ~[?:1.8.0_162] {}
at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1394) ~[?:1.8.0_162] {}
at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1750) ~[?:1.8.0_162] {}
at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:477) ~[?:1.8.0_162] {}
... 3 more
>
Process finished with exit code 1
It looks like, that there is an issue in accessing the private method MinecraftServer#isAheadOfTime
.
I updated my mod to the same Forge version as your lib uses (1.16.5-36.0.4) and I tried the lib versions 1.4.1 and 1.4.3.
What am I doing wrong?
Here is my test branch: https://github.com/cech12/CeramicBucket/tree/feature/automated-tests
and the related commit: cech12/CeramicBucket@e3f16b3
Thanks for your help! :)
I'm trying to get the library to run using MC 1.18 Is it even possible? Also, which 'run' do I execute because doing a Run with runServerTest returns the following:
[19:12:20] [main/UNITTEST]: TestServerLauncher Starting
[19:12:20] [main/UNITTEST]: Forge is calling, they want their ArgumentList back. This is a bug!
[19:12:20] [main/UNITTEST]: Error:
java.lang.ClassNotFoundException: net.minecraftforge.userdev.ArgumentList
at jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?]
at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at java.lang.Class.forName0(Native Method) ~[?:?]
at java.lang.Class.forName(Class.java:375) ~[?:?]
at com.alcatrazescapee.mcjunitlib.DedicatedTestServerLauncher.main(DedicatedTestServerLauncher.java:34) [mcjunitlib-1.4.4-1.16.5_mapped_official_1.18.1.jar:1.4.4-1.16.5]
using runClient starts MC no problem but nothing is displayed from mcJunitLib. Any help would be greatly appreciated.
Hey!
I love this testing library! I started to port my mods to 1.17 and I miss the test aspects^^
So here is my question: Are there any plans of porting this library to support 1.17?
Maybe I could support you doing this.
Greetings
Chris
Only junit-jupiter-api
and junit-jupiter-engine
are currently bundled. JUnit5 also has the junit-jupiter-params
package that is required for parameterized tests.
I've been trying to update some previous tests on https://github.com/CompactMods/CompactCrafting and no matter which version I try, it appears the JUnit discoverer is stopping or not discovering any of my test classes.
The classpath directories appear correct, and it looks like the prerequisite builds and combinations of my API lib and main code are all there.. so I'm lost.
Things I've attempted, with no luck:
targetModId
environment linesourceSets.test
(and main/api) under mods { compactcrafting { } }
destinationDir
from the JAR tasksI created the ExampleTest.java
and its in the src/test/java folder.
When I RUNAS Junit Test, the run fails with Java.lan.ExceptionInitilaizerError.
I don't see (or know how) to get runServerTest working.
When I RUNCONFIGURATIONS runClient it starts MC no problem but I don't see anything
The Console does not display anything about [Server thread/UNITTEST]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.