PL 400 : Test and Debug PCF components by using the local test harness(Create a Power Apps Component Framework (PCF) component)

Testing and debugging are the most important processes in app development and both the processes play an important role in the code component. Whereas testing reduces the difference between expectation and actual functionality and debugging  helps in code improvement. Both processes provide information about the health status ,data structure of the app and allow easy interpretation.

After the code component is implemented, npm start or npm start watch helps to build the code component and open the code harness in a new browser. In a test harness, changes are quickly reflected in the code component.

When any of the following component property changes, it is automatically reflected in the test harness without restarting it.
  • index.ts files
  • imported modules in index.ts (excluding node modules)
  • All of the resources tested in the controlManifest.Input.xml file

Power Apps Component Testing Harness is a utility created by Microsoft to help you quickly deploy Power Apps components in a local environment. We have already seen this utility in action, if we have read the exercise in writing code components in this module. You can start a local test harness from within a Power Apps component project by using the npm start command.

Debug a code component by using browser debugging:

Most modern browsers have a variety of built-in debugging capabilities. Microsoft Edge, Google Chrome, Mozilla Firefox, and Apple Safari each have built-in developer tools that allow for interactive debugging experiences.


Common limitations when using the test harness

While the test harness is suitable for testing simple code components, the following scenarios may mean that the test harness cannot be used to test a more complex code component:

  • The updatedProperties array is not populated when properties are changed via the test harness Data Inputs section.
  • Using features listed in the feature-usage section of the ControlManifest.Input.xml. For example, calling the context.WebApi.* methods will throw an exception from within the test harness.
  • Use of the paging, sorting, and filtering APIs on datasets will throw an exception from within the test harness.
  • Use of complex datatype bindings that provide additional metadata such as choices and lookups. For choice columns, the test harness will give you three simple choices with minimal metadata.
  • Model-driven apps specifics such as field level security, read-only behavior, dataset selection API, and integration with the model-driven apps command bar.
  • Other context APIs such as Navigation and Utility methods.

Comments

Popular posts from this blog

Powering Up Your Analytics: Exploring Power Query in Power BI

Power App Component Overview : Canvas App vs Model-Driven App

Exam PL-400: Microsoft Power Platform Developer