Embedded bukkit for testing

Discussion in 'Spigot Plugin Development' started by twanneke8, Sep 4, 2016.

  1. It would be cool to have a testing library where we can automatically test our system as a whole, with fake, controllable players etc.

    I am currently writing MockedBukkit which just mocks a few bukkit methods like Bukkit.getServer(), this is only useful for interface testing (Testing parts of the system).

    This is not a requirement for me to write my plugins, though it would definitely be cool to be able to write some essential system tests which get evaluated automatically (For example does my minigame teleport players when it start...).

    I think it'd be cool to be able to system test our plugins automatically, is this doable/reasonable?
    • Winner Winner x 1
  2. I'd love to see the outcome of this, it would be great. Don't know how you would make the players controllable but this sounds like an awesome okay.
  3. Meet Mockito ;)
  4. Or you could download some client and use an offline mode server.
  5. It wouldn't be automatic then :p
    I assume this is something like test-driven development? You put a bunch of tests and when you push github will make sure all the tests pass so you don't have to test yourself
  6. Computers can never beat humans in testing and finding bugs.
    Okay, computers can beat humans in testing in maths and stuff, but who told the computer how it does the math and the best way to do it?
    We did. Humans. So again, humans > computers.
    • Funny Funny x 1
  7. There are really a few types of testing. I think what you are after is full system tests. I think this is doable by creating a custom spigot build which takes player input via an object adapter rather than packets. Alternatively, you can create a special client that can be controlled with the testing software.
    • Like Like x 1
  8. TDD is only done through unit tests. I'm on about system tests, these test your system as a whole (not a specific function). Whenever you edit your source you want to make sure your plugin still functions as a whole. You can definitely test all the individual components with unit testing (which does not require an embedded spigot) but when you want to test if you're system functions as a whole, without mocking any classes, you require an embedded spigot.
  9. This is exactly what I'm on about, but the clients do not feel like an issue to me, it's more about the embedding and making sure the tests are isolated and quick.
  10. Maybe something fluent, like create a game client, gameclient.connect() gameclient.<insert client action here>()
    then just use verify from mockito
  11. Do you have a github? I'd love to contribute and see it!
  12. Most of our projects are hosted here: https://github.com/Exorath/ but we have yet to start on this one as I'm a bit scared by the scope of this.
  13. Don't be worried. I am definitely supporting this project in any way I can. Launch it! A lot of people would be happy.
  14. Amazing, if you want you can add me on skype to discuss the scope of this, it's twanneke8.
  15. Unfortunately I've stopped using skype. I can still communicate thru private-messaging on here.
  16. Haha all right.
  17. If you use something like gradle it is possible to set it up so you have a task that can compile your program, archive it into a jar, place it into the plugins folder of a minecraft server and then reboot that server. It may not be quite the same, but can help save you time when testing.
  18. Hell, even IDE's provide that. (*cough* IntellIJ <3 *cough*)
  19. Shhhhhh
    But yeah, this would save me a heck ton of time...
  20. Definitely, but what we're after is a self contained (no external server required), automatized (you do not have to manually test the functionality) and isolated system (one test will not affect another).