How do I measure the Unit Test Coverage on the API Proxies

Not applicable

Hey there, we had built JMeter tests against the proxies, but we have nothing really can use to measure the code coverage on the testings.

Any ideas? or what is the best practices from ApiGee development. - Istalbull?

Thanks,

Albert

0 2 847
2 REPLIES 2

Not applicable

Great question @Albert LIn! You certainly can do test coverage of Apigee API Proxies. If your API proxy is based on Node.js you can certainly leverage Istanbul. Here's a tutorial that my colleague @Ozan Seymen wrote https://community.apigee.com/articles/4188/unit-testing-code-coverage.html.

Also, since your Node.js API Proxy runs on your laptop, you can leverage all available tutorials online. Here's a good one for Express.js Apps. http://www.gregjopa.com/2014/02/testing-and-code-coverage-with-node-js-apps/

For XML Policies, please try this framework that my colleague @sriki77 posted. https://github.com/apigee/apigee-proxy-coverage

Not applicable

Hey Diego,

I ran instr_prepare.sh, seeing the error below. Do you know what I had missed?

Thanks,

Albert

mlin6@WABOTHDK0544035 /tmp/apc $ ./instr_prepare.sh Downloading API Bundle IFM revision 287 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 78333 0 78333 0 0 79622 0 --:--:-- --:--:-- --:--:-- 99k Instrumenting IFM bundle SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Instrument File generated: IFM-287_instr.zip Deploying Instrumented IFM bundle Import failed to /v1/organizations/productdev/apis?action=import&name=IFM with status 400: { "code" : "messaging.config.beans.TargetValidationError", "message" : "Error in target RiskManagement. Invalid condition: ((errorCount >= 1) and (not((errorCode1 is null) or (errorCode1 = \"\")))) in policy cf_HttpCodeLookupForError11470767781626. Reason: Incomplete or Malformed expression", "contexts" : [ ] } Deleting Instrumented KV Data { "code" : "keyvaluemap.service.keyvaluemap_doesnt_exist", "message" : "KeyValueMap instrument does not exist", "contexts" : [ ] }Note: You can ignore the last error - its trying to delete a key value map named 'instrument' if it exists.