In this insightful tech talk, we'll delve into two crucial aspects of app development. This session focuses on the new enhancements on Request templates with dynamic hosts and dynamic query params with understanding the changes in template and app code needs. The second part of the session is about code coverage importance and understanding how developers can build apps with recommended code coverage standards.
- Overview of new enhancements - Dynamic query params and dynamic hosts (serverless)
- How to define the template and use the context in-app and serverless
- Overview of code coverage
- Importance and working with code coverage reports
- Understanding the new enhancements on request templates
- Implementation of dynamic hosts and dynamic query parameters
- Importance of code coverage
- Understanding and building apps with code coverage reports
26th October 2023
5:30 pm IST (India)| 2:00 pm CET| 1:00 pm GMT (London)
Check your time zone
Q1: Can we send data to a middleware application to store data in our own database? So would the app be marked as verified by Freshworks?
Ans: You can store data in your database but certain PII data and other concerns would have to be addressed during the app review process.
Q2: I found it very difficult to test the exception blocks… if you are calling a third-party API, how can I make it return some error so code coverage would count as executed?
Ans: Agreed, it is difficult to handle all the exception blocks. There might be some assumptions made while handling the errors from third-party applications. They have to be tested as well to ensure the app can handle when the expected error happens. To test them, there might be a need for additional effort in modifying the configurations, environment variables, or any relevant system touchpoints modifications. For example, the installation parameter values can be modified to make API endpoints fail with unauthorized errors. Network throttling in the browser is another option to let the APIs fail with a timeout error. Find a way to make the API with third party fail in the desired way without modifying the app code.
Q3: How to cover the conditional code without touching the app files… Is there any way like you did in the local store file
Ans: The way to cover the code with executing the code in different branches are the same as above. The intention of the code coverage requirement is also the same that each statement in the code has to be tested and conditional code will have a different branches of code that also needs to be tested. To test them, you might have to reproduce the scenario to test the case. It might require changes in the configurations, environment changes, and changes in the third-party applications, and so on. It would vary case by case-basis.
Q4: Is code coverage working for react apps?
Ans: No, the code coverage is not possible for react and other framework-based apps that requires code compilation after the app is tested at the build time. When using any frontend framework, please follow the steps as per the code review guideline for code minification and the code coverage requirement is not applicable since it’s not possible.
Q5: What is max timeout we can increase for serverless applications?
Ans: The max timeout available for external events that are on the serverless app is 20s.
Q6. Is there any specific reason to give higher precedence to the predefined in json? IMHO, predefined should be considered as default and values passed at the time invoking should override the default value.
Ans: The request templates are designed to define the request method with needed parameters before hand so that values are not misconfigured during runtime. So the precedence for the value in request.json is higher than value passed during invocation at runtime.
Q7. I understand the security concerns in allowing dynamic headers. But, it shouldn’t be the case now as predefined values take precedence with the new design?
Ans: Since there could be scenarios where values are passed from the front-end, this can allow the agent to override dynamic query params in order to restrict, we have designed with the precedence order.
Q8. It’s a crazy idea to add more codes to increase the coverage. Instead, you should consider extracting the shared codes such as request handlers, logs and error handlers. I mean avoid writing repeated codes and write reusable codes
Ans: Agreed. But, reusable code is always recommended regardless of the code coverage. In certain cases when the app is lean and doesn’t have a lot of functionality, there are no other ways available to cover the code, increasing the code with additional branches and statements are one of the workarounds to attain the code coverage to the required level.
Q9. Could you please confirm whether this is only for marketplace apps or it also applicable to custom apps?
Ans: The code coverage requirement is only for public Marketplace apps. It’s not required for custom apps.
You can also have your questions ready beforehand, as we have a live Q&A during the session, where our fantastic DevExperts will answer your questions.
Can’t attend live? You should still register. We’ll share the recording after the session.
We are looking forward to seeing you at the next event!