Testing plugins converted fo Dynamics 365 online using Visual Studio and PRT

apollo7
apollo7 used Ask the Experts™
on
CRM 2013, Dynamics 365 online

I am looking for a method to test plugins converted for D365 from CRM 2013.  With a Dev environment, how can this be done using Visual Studio and the PRT?

Ideas are: on Dev, if we register the plug-in assembly, ,register a plug-in step for an event and test its execution by doing whatever is shown in the code.  For example, step through the code as a plugin and test that it performs the actions in the CRM 2013.

Questions: can Visual Studio be used in Debug mode to step through the code and provide an adequate test?  Can the PRT be used to view the registered plugin and verify that the plugin ran as expected?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Let me know if the following steps are correct or could be done in a different way:

Dev Environment Testing

•      Select Create New Connection
•      Select Office365 Type Connection
•      Register New Assembly
•      Browse for dll (PluginTest.dll)
•      This should show it is isolatable
•      Register New Step
•      Execute an event that triggers the plugin or step through the code in Debug mode to reveal any errors.
•      Highlight any errors and fix in Visual Studio
•      You should see the description updated and that the plugin ran
•      To see the plugin is registered in Dynamics 365, browse to the default
        solution to see the assembly registered under Plug-In Assemblies.
•      Under Sdk Message Processing Steps, the new step shows as registered
.
When the plugin runs as expected in the Dev environment, you are ready to create a solution to export to the QA or Prod environment.
Chief Technology Ninja
Distinguished Expert 2018
Commented:
Hi apoll07,

You are partially correct. The steps you have mentioned are good for registration and functional testing.
If you want to debug a plugin that is registered in Dynamics 365 Online, you must use Plugin Profiler.
You can find step by step instruction as well as the instruction for Disconnected/Remote/Offline debugging of the Plugins

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/analyze-plugin-performance

PS: Please do not get confused with the page's title.

Regards,
Chinmay.

Author

Commented:
The Plugin Profiler is needed because the plugin is in Dynamics 365 Online.  It seems to be an extension to the PRT
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Yes it is an extension to PRT. And you can use it for On Premise installations also.
Rikin ShahMicrosoft Dynamics CRM Consultant

Commented:
Hi,

If you want to go for unit testing of your plugin within Visual Studio. You can go for FakeXrmEasy framework. It provides you a fake Xrm context.

As far as you're working on simple plugin steps, you can unit test them. I do remember, it does not work with EntityMetadata.

Check this post for simple steps- https://community.dynamics.com/crm/b/dynamicscrmdevdownunder/archive/2016/11/21/plugin-integration-tests-using-fakexrmeasy

Regards,
Rikin

Author

Commented:
One last question: can the code be debugged using Visual Studio if the Dev environment is not a duplicate of Production?  Or do I need the Dev server to include all the entities, solutions, etc. that are on the Production server?
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
That's the whole point of offline debugging. You won't need the Dev Environment at all. But then how would you really check the functionality of the Plugin? It has to be executed in an environment where all the necessary components are in place i.e. You should have the solutions installed.

Author

Commented:
Thanks for the answers, very helpful

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial