testing gin gonic routes

1,327 views
Skip to first unread message

Dan Judd

unread,
Jun 30, 2015, 6:45:09 PM6/30/15
to golan...@googlegroups.com
Does anyone have experience testing gin gonic routes? It seems pretty complicated to create a mock context and am trying to figure out how. Thanks!

Kiki Sugiaman

unread,
Jun 30, 2015, 9:53:58 PM6/30/15
to golan...@googlegroups.com
The same way you test any other (say, net/http) routes. Only this time with gin specific router and handler.

http://play.golang.org/p/qyhD0mlCST

(I'd say that testing routes is not a good unit testing practice in that they're not "unit" enough, most of the time, unless you want to roll-out an integration test, but that's not your question)


On 01/07/15 08:45, Dan Judd wrote:
Does anyone have experience testing gin gonic routes? It seems pretty complicated to create a mock context and am trying to figure out how. Thanks!
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages