HttpCalloutMock in test class Salesforce | HttpCalloutFramework

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 พ.ย. 2024

ความคิดเห็น • 11

  • @chidinjoku1101
    @chidinjoku1101 2 ปีที่แล้ว +1

    Certainly not a waste of time. Thank you very much. Much appreciated.

  • @AnkitSharma-ok7ll
    @AnkitSharma-ok7ll 2 ปีที่แล้ว +2

    This is a very nice explanation of how test class donot allow to call actual endpoint. Many Many thanks.

  • @P1otrB
    @P1otrB 2 ปีที่แล้ว +2

    Wow, this is exactly what I needed. I need multiple methods to test different status codes and the guide I was following hard codes the status values in the Mock class. I needed this, thanks so much!

  • @prakashmp3915
    @prakashmp3915 6 หลายเดือนก่อน +1

    very good example..

  • @ratikeshgaonkar3621
    @ratikeshgaonkar3621 ปีที่แล้ว +1

    Good One

  • @antimonyrocks3939
    @antimonyrocks3939 6 หลายเดือนก่อน +1

    Hi, very informative video! I have a doubt though. I have a class which makes an api call. I have the secret key and service url stored in custom metadata. My class retrieves this as a map from the metadata. How do I do the testing for such a class?

    • @ProgrammingMadeEasy99
      @ProgrammingMadeEasy99  6 หลายเดือนก่อน

      Simply just create the desired output or copy the value from the response of that Api. In test ass it will auto pull the metadata info. You just need to call the associated Apex method with necessary params that you might have created and u are good to go.
      Hope this helps.

  • @Danny-oo4df
    @Danny-oo4df ปีที่แล้ว +1

    What if we have to test multiple methods ? Can we put mock code in @testSetup annotation to made these available for all methods in test class?

    • @ProgrammingMadeEasy99
      @ProgrammingMadeEasy99  ปีที่แล้ว +1

      Yes in test setup u can put all of them like say 3 account records with different record types etc as per requirement in the corresponding methods u can query them .