Unit test plugins

I would like to make unit test to each plugin we wrote, from what I can see in the Kong project they only doing integration tests including DB use, also i didn’t find any plugin that come with tests.
There is any way to do unit tests and stub NGX?
I tried with busted but I had trouble stubbing all the NGX functionally.


You can use resty, e.g. that’s what we use:

Of course some APIs in ngx.*space are not available to timer phase on which resty runs its code, so beware of that.

Many standard OpenResty libraries use test-nginx, so that is one option as well. You need perl for that: