Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

Posted on by 95

Hi Everyone,

I was using executeMultipleRequest to Execute multiple requests at the same time in my plugin. Now I just want to write my Unit test cases to cover my plugin code.

Did anyone worked on executeMultipleRequest in unit test Cases? 

  • Verified answer
    Daryl LaBar Profile Picture
    Daryl LaBar 500 Most Valuable Professional on at
    RE: How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

    I'd argue with you on the "but I can't" part.

    That video I gave shows how to use MS Fakes to fake out the RetrieveMulitpleRequest, and you'd basically follow the same method for the executeMultipleRequest.  You'd have to Fake out the Execute, and then check for the request to be an ExecuteMultipleRequest, and have it return an ExeucteMultipleResponse.

  • Sreeekanth Profile Picture
    Sreeekanth 95 on at
    RE: How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

    Hi Daryl LaBar, I agree with you, but I can't use FakeXrmEasy. I should only use MS Fakes and there is no alternative for me.

    Anyhow thanks for your prompt reply.

    Kind regards,

    Sreekanth.

  • Suggested answer
    Daryl LaBar Profile Picture
    Daryl LaBar 500 Most Valuable Professional on at
    RE: How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

    Stop it.  Stop it right now.  Don't ever use MS Fakes for the IOrganizationService.  It's horrible.  

    Here is a video of me explaining how to do it for the RetrieveMultiple Request using fakes, and how to do it with FakeXrmEasy, and my framework XrmUnitTest.

    youtu.be/dRz1X6pdsk4

  • Sreeekanth Profile Picture
    Sreeekanth 95 on at
    RE: How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

    Andrew Butenko Got it.  Thanks.

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

    Sreekanth, Daryl, who I referred in my reply created on of UnitTesting frameworks for Plugins so I asked him to join the thread and reply if he has covered it in his framework.

  • Sreeekanth Profile Picture
    Sreeekanth 95 on at
    RE: How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

    I should cover, I'm trying but getting error.

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: How to Write Unit Test cases for executeMultipleRequest using Microsoft Fakes

    Daryl LaBar do you have it covered in your Unit Test framework?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans