Search code examples
apigee

Unit Testing Apigee APIs


I've looked through the documentation and don't see anything related to unit testing of APIs created with Apigee. With our current homegrown APIs we're writing today, we can inject and mock dependencies for unit testing and integration testing. Is this something that's possible with Apigee at all?


Solution

  • Apigee policies are more properly understood to be configuration items and as such would not be unit testable - rather they are only testable as an integration target which are readily automated with our Maven plugin.

    Java callouts, javascript callouts, Node servers, python callouts and the like are testable in an offline mode using the same tools you use today. Your harnesses of course will have to take into account the context of execution - which is not trivial. Apigee today does not provide any tooling to provide that context. Of course if you already unit testing homegrown APIs you probably have experience with something like RhinoUnit.

    To summarize - my point of view is that policies are configuration and as such are not unit test targets. Some resources (which are referenced in a call out policy for instance) are code and are appropriate targets for unit test.