# Go RPC Functions testing

**URL:** <https://forum.heroiclabs.com/t/go-rpc-functions-testing/3976>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [June 20, 2023, 11:12pm UTC](https://forum.heroiclabs.com/t/go-rpc-functions-testing/3976 "2023-06-20T23:12:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kutsme](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/kutsme/32/1060_2.png) [@kutsme](https://forum.heroiclabs.com/u/kutsme)\
**Post date:** [June 20, 2023, 11:12pm UTC](https://forum.heroiclabs.com/t/go-rpc-functions-testing/3976/1 "2023-06-20T23:12:36Z")

</div>

Hi. How I can cover my Go RPC functions with tests with mocks (context, logger, db etc.)?  
Thanks

---

<div class="post-metadata">

**Author:** ![kutsme](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/kutsme/32/1060_2.png) [@kutsme](https://forum.heroiclabs.com/u/kutsme)\
**Post date:** [June 23, 2023, 11:07am UTC](https://forum.heroiclabs.com/t/go-rpc-functions-testing/3976/2 "2023-06-23T11:07:06Z")

</div>

Can anyone suggest a way please?

---

<div class="post-metadata">

**Author:** ![xsampedro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/xsampedro/32/1448_2.png) [@xsampedro](https://forum.heroiclabs.com/u/xsampedro)\
**Post date:** [June 26, 2023, 10:17am UTC](https://forum.heroiclabs.com/t/go-rpc-functions-testing/3976/3 "2023-06-26T10:17:29Z")

</div>

It is possible to mock those. One way is using [GitHub - vektra/mockery: A mock code autogenerator for Go](https://github.com/vektra/mockery)

E.g.:

```auto
//go:generate mockery --name NakamaInitializer --inpackage --with-expecter --case=underscore
type NakamaInitializer interface {
	runtime.Initializer
}

```
