Apiproxy Code Coverage

Hi,
I want to check the code coverage of apiproxy.
I have installed the sonar plugin.Also made the sonar-way-apigee as default profile.
Can someone please help me with following questions.
1.How to write junit test cases for apiproxy?
2.How to check the apigee proxy code coverage using sonar apigee plugin?

0 1 215
1 REPLY 1

1. The topic of testing API proxies has been asked a few times and a very comprehensive answer to this question would be https://www.googlecloudcommunity.com/gc/Apigee/Unit-Testing-Api-Proxies/m-p/31531/highlight/true#M25.... Basically you would apply unit testing at the custom code level (jUnit for Java Code) and use integration test to test the remainder of your API configuration.

2. https://github.com/ntiss/sonar-apigee-plugin is a Sonar wrapper around apigeelint and performs a static code analysis to ensure that the proxy bundle adheres to certain rules. In your CI/CD pipeline you most likely want to use a combination of unit testing and static code analysis like shown in this reference: https://github.com/apigee/devrel/tree/main/references/cicd-pipeline. The the Unit test code coverage won't be shown in the sonar output and Apigeelint validates the entire proxy bundle against the given rule set.