Activity Forums Salesforce® Discussions What is mock class in Salesforce?

  • Deepak

    Member
    September 16, 2020 at 3:08 pm

    To deploy or package Apex, 75% of your code must have test coverage. By default, test methods don’t support HTTP callouts, so tests that perform callouts fail. Enable HTTP callout testing by instructing Apex to generate mock responses in tests, using Test.setMock.

  • Ratnesh

    Member
    September 17, 2020 at 7:49 am

    So in simple words, mocking is creating objects that simulate the behavior of real objects. In unit testing, we want to test methods of one class in isolation. But classes are not isolated. They are using services and methods from other classes.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos