Actually i have been building on app in freshservice using fdk. i have if else condition. if condition has been executing always. else part will work some time only. so can i manage this is in code coverage.
Hi @rahman_alla,
Please refer to the code coverage guide to find out how to test the else
condition in your case.
Code coverage ensures that app developers test all scenarios and that the respective behavior is executed properly as expected. Even rare conditions have to be tested with some simulation involving inputs or an environment.
If some conditions are impossible to test, please leave them with the 20% buffer the platform provides in the code coverage requirement with only an 80% code coverage requirement for app submission for Marketplace apps.
If you are building only a custom app or are in the early stages of testing, please use the fdk pack -s
flag to skip the code coverage check for testing.
https://developers.freshworks.com/docs/app-sdk/v3.0/common/basic-dev-tools/freshworks-cli/#pack
thanks bro. really help full for me
Brother, actually i am building app with serverless also. here i have implemented API logic also. i had implemented else block for rate limit. so here rate limiting will happen ocassionally. so what should i do. should i do unit test case with jest or need to do something else?
@rahman_alla A Serverless app can also be tested for code coverage thoroughly.
If the API rate limit can be simulated, you can do that and cover the else block. If it’s rather easier to test it with an integration test framework, you can do it as well.
Unit tests will not work as FDK tracks code coverage only when the code is executed with FDK. So. check the code coverage of FDK if it tracks. If it works, anything is fine.