Nakama Golang RPC Testing

Hey

How are u guys writing tests for your RPCs?

Has anyone given nktest a go and got it working?

In our game, we are approaching to testing with different manner. Since we are using lua for scripting i have made a whole testing environment for nakama in ZeroBraneEditor, and what we can do, we can pretty much mock everything or execute whole logic without the need of turning on servers or running clients. However in clients we do need to run different kind of tests for animation and are packets correctly parsed/received and is game state same as server one.
If we want to test scripts with real data, all we need to do is export database as csv and import it in testing framework.
And example to testing a rpcs is something like this:

As for match/logic, it is same, use users, create match instance and then do the calls.
Some drawbacks in this approach:

  • Atm i am lacking multi test execution but working towards to have it.
  • Sometimes there are differences in Lua modules (stock/5.1/5.2) and gopher lua in nakama so some things may work a bit differently
  • Writing tests can take a bit of time,still way too programmer oriented, goal with this was to try to make testing available for any non programmer user like QA, or even designers
  • Lack atm with visual edit for preview, but ZeroBrane with love can do rendering so will see about it :slight_smile:
  • Changes to DB…Saving is not implemented to csv export of databases, but it can be for better testing.

I see, I wanted to try and keep everything in Go, otherwise I would probably resort to js and do something similar to you ye.