How do i UNIT Test my proxies.what is the best approach...
Answer by ozanseymen
·
May 11, 2015 at 08:14 PM
With an Apigee implementation, when we talk about unit testing we are mostly referring to "unit testing" custom code like javascript, java, python, node.js - and it is whole different debate how useful they are if your integration testing is touching most/all of the code. They are extremely useful if custom code doesn't participate fully in API responses, e.g. loggly integration code in JavaScript or any other service callout that doesn't contribute to API responses.
However it is a must-have to do proper integration testing for your API - this would test how clients are integrating with the API and in turn how API is integrating with the backend components. In order to do that you would hit the northbound API interface with some input and assert the responses from the API (as in @dzuluaga's example above).
I'd argue that unit testing frameworks are too low level for doing such API integration testing. This is the whole reason why we are working on frameworks/tools like apickli (https://github.com/apickli/apickli).
Just for comparison, here is how @dzuluaga's example above can be written using apickli/gherkin:
Scenario: Check whether in cities GIVEN I set User-Agent header to request WHEN I GET /weathergrunt/apigee/forecastrss?w=2502265 THEN response body should contain Sunnyvale, Madrid AND response code should be 200
Full gherkin language supported by apickli can be found here: https://github.com/apickli/apickli#gherkin-expressions
Slight typo in that apickli URL: https://github.com/apickli/apickli :)
Answer by Saul Zukauskas · May 11, 2015 at 08:54 PM
Great discussion!
JMeter as great as it is for performance testing stores test scenarios in custom XML structure and this becomes an issue if you have more than one person writing tests and using code version control.
Cucumber is a nice little framework which is used by many teams for all sorts of testing.
As @Ozan Seymen mentioned above project we created based on Cucumber.js (JavaScript implementation of Cucumber framework) might be what you are looking for.
It supports both Gulp and Grunt task runners and can be fully automated as well.
Answer by suresh prabhu · Jan 22 at 09:59 AM
Apigee api can be tested using postman and you should enable trace in debug -->start trace and once you fire the api you can see the logs/values/policy execution in detail in trace and this way we can do unit testing.
Fetch WSDL Error: Could not download resource. peer not authenticated. 6 Answers
Api proxy to Swagger code 5 Answers
Getting Error Creating Proxy from WSDL 2 Answers
deploy-bundle failed due to proxy 1 Answer
load balancing proxies 0 Answers