Open CubBossa opened 3 months ago
Hi, I really glad that you found this library usefull
1.20 support
Isn't this library just working on the 1.20 version?
And I wondered if there is a way to simulate player activity.
When It comes to player activity, it is not really simple and possible to simulate real player actions, since it would
required to join actuall player to server. Right now as you might found addPlayer("a");
creates virtual player that has
all statistics and method working however it's like ghost
Could I possibly simulate a right click on a Block from a player?
Yes, To do so, you would need to publish PlayerInteractEvent with test
player as argument. It is totally possible
since PluginTest
has method for publishing events
' generate test classes based on what I do ingame'
This sound so cool! I would love to do that, however recentlly I don't have much time for my side projects anyway you can contribute to this project :D
Bdw you should watch this. https://www.youtube.com/watch?v=vXaWOJTCYNg
Mojang empoyee presents how they are testing game using own Testing framework
1.20.4 shows this result on my server:
[11:30:19] [Server thread/INFO]: [SpigotTester] Server version: v1_20_R3
[11:30:19] [Server thread/INFO]: Constructor validation error
[11:30:19] [Server thread/INFO]: Looking for: Constrcutor class net.minecraft.server.level.EntityPlayer
[11:30:19] [Server thread/INFO]:
[11:30:19] [Server thread/INFO]: Different parameter count public constructor net.minecraft.server.level.EntityPlayer(net.minecraft.server.MinecraftServer, net.minecraft.server.level.WorldServer, com.mojang.authlib.GameProfile, net.minecraft.server.level.ClientInformation)
[11:30:19] [Server thread/INFO]: Different parameter count public constructor net.minecraft.world.entity.Entity(net.minecraft.world.entity.EntityTypes, net.minecraft.world.level.World)
[11:30:19] [Server thread/INFO]: is not public protected constructor net.minecraft.world.entity.EntityLiving(net.minecraft.world.entity.EntityTypes, net.minecraft.world.level.World)
[11:30:19] [Server thread/INFO]: Different parameter count public constructor net.minecraft.world.entity.player.EntityHuman(net.minecraft.world.level.World, net.minecraft.core.BlockPosition, float, com.mojang.authlib.GameProfile)
[11:30:19] [Server thread/WARN]: [SpigotTester] SpigotTester will not working for this minecraft version, try different
About the fake players: an alternative would be to restrict the library to offline mode servers and simulate joining players via packets. Meaning the server tracks fake clients completely managed by the framework. The advantage would be that plugins based on packets could be tested too. To improve performance I render some static entities client side in my plugins and when the player clicks such entity, events would not fire serverside.
Thanks for sharing the vid!
ok I see issue with NMS, I can fix that, no problem
Sure if you have idea how to incorporate tracking ingoing and outgoing packets in the single test lifespan, we can implement that
Righto, I'll start by making a test suite for my plugin in 1.20 when you updated and then from that I'd contribute and test my changes on that suite
Hey, I think integration testing for plugins could be pretty useful and wondered if there will be a 1.20 support in the future
And I wondered if there is a way to simulate player activity. For example I have this editor where players can right click a block to create a graph node in their world (used for citizens pathfinding and stuff). Could I possibly simulate a right click on a block from a player?
And if you really wanted to go crazy, there could be a record functionality to generate test classes based on what I do ingame. Like
spigottester --record create graph node
, then type command, right click block, what ever. thenspigottester --stop
generates a java.class file in the plugin dir that contains a list of player action simulations likeof course the assertions must be added by hand but it would help a lot to quickly do your usual tests by hand but record them at the same time.
I'd love to help you out and am more than willing to try the record feature but I'm trying to avoid nms at all cost and would hope that you could add 1.20 support