Achieve the Code Coverage standards

For Freshworks Marketplace apps, we recommend 80% code coverage in the app. In this section we will understand how 80% code coverage standard could be achieved.

  • Before testing, check if FDK CLI has any recent updates and update to the latest version.

  • Perform pre-production sanitization on the code to remove all the unnecessary code as the code which is not executed contributes to “uncovered code” when calculating code coverage percentile.

  • For accurate code coverage, after the app development ensure to delete the coverage and .reports.json. Test the app thoroughly.

  • When testing the app, ensure there is no code changes as this resets the code coverage reports for that specific file.

  • Testing the app with all possible flows - positive and negative so that app is functional as per the requirements in both the positive and negative scenarios. This ensures the code coverage for success and error conditions which improves the overal coverage report.

  • For better testing experience, create unit test cases and a testing framework like Mocha or Jest with fdk test to ensure that all the cases are well tested.

  • If the app is using any configurations from installation parameters (iparams), locally update with different values which are valid and invalid to test the app behaviour with both configurations.

  • When testing Serverless apps, use the local serverless test (http://localhost:10001/web/test#) with different payloads which would test the app with expected and unexpected payload structure and values.

  • Ensure all the functions / lines / blocks are executed at least once. To verify, in the code coverage report for each file will have the number of times the line was executed marked in green “number x” next to the line number.

  • Front-end frameworks like React and Vue apps are currently not supported with code coverage. If you are submitting the Freshworks Marketplace app developed with React or Vue frameworks, kindly mention the same when app review process updates are communicated to you.