[SalesForce] Apex Test Class – Limits Query

This is a newbie question.

Let us assume that I have the following test class

@isTest
class xyz
{
  @isTest static void method1() {...code..}
  @isTest static void method2() {...code..}
  @isTest static void method3() {...code..}
}

Questions

a) Is it possible to execute only a specific methods from the above test class ?.

I always execute a test for the whole test class.

Can someone clarify whether it is possible for me to execute only a specific
test method ?

b) How are the governor limits' calculation done when the whole class' methods are executed ?

For example we know that SOQL Query limit is 100 per transaction.

Does this 100 SOQL query limit is applied against all the methods (method1,method2 & method3)..or every test method has its own governor limits ?

In the above example what is the SOQL query limit for the whole test class ?

Is it still 100 to be shared across 3 methods or 300 (3 x 100 ..100 for each method) ?

Hope I am clear.

Best Answer

a). No, when you execute a test class, it runs every method in the test class.

b). Governor limits are reset for each test method. In addition, some governor limits are reset in between the Test.startTest() and Test.stopTest() functions used commonly in test methods.

Here's a good guide to getting started with test methods: An Introduction to Apex Code Test Methods

Related Topic