Sunday 20 September 2015

Code Coverage Report in excel Format | Test Class Result in XLS

Now you can view the overall and individual entity code coverage in your organization. The results of the code coverage can be downloaded in Excel format

For Same you Can install the below App Exchange Product

Code Coverage Report

How to configure the App. 
Please check below link for same.

How To Configure This APP

You can check the Setup step in Installation and Configuration Tab

Step 1:- Setup Remote Site Setting

Add a value for Remote site setting (In same org in which package is installed)
Goto Setup > Administration Setup > Security Controls > Remote Site Settings Add value to your Salesforce instance, for example  '’

Step 2 Setup Base URL

Please set your Base URL.
Go to Setup > Develop > Custom Settings > Code Coverage Configuration > Manage > New. Set the name to 'baseUrl' and the value to your Salesforce instance, for example ''

à Open Custom Setting and Click on Code Coverage Configuration 

à Then click on Manage

à Then click on Manage and then New Button and then Enter the below detail
Name as :- baseUrl

(Please enter your org base url.)

Thursday 3 September 2015

Test classes with @isTest

Use the isTest annotation to define classes and methods that only contain code used for testing your application. The isTest annotation on methods is equivalent to the testMethod keyword.

  1. Classes and methods defined as isTest can be either private or public. Classes defined as isTest must be top-level classes.
  2. One advantage to creating a separate class for testing is that classes defined with isTest don't count against your organization limit of 3 MB for all Apex code.
  3. You can also add the @isTest annotation to individual methods
  4. Classes defined as isTest can't be interfaces or enums
  5. Methods of a test class can only be called from a running test, that is, a test method or code invoked by a test method, and can't be called by a non-test request.
  6. Test methods can’t be used to test Web service callouts. Instead, use mock callouts
  7. You can’t send email messages from a test method
  8. Methods of a public test class can only be called from a running test, that is, a test method or code invoked by a test method, and can't be called by a non-test request.

private class MyTestClass {
   @isTest static void test1() {
      // Implement test code
   @isTest static void test2() {
      // Implement test code

IsTest(SeeAllData=true) Annotation

use the isTest(SeeAllData=true) annotation to grant test classes and individual test methods access to all data in the organization,

  1. If a test class is defined with the isTest(SeeAllData=true) annotation, this annotation applies to all its test methods whether the test methods are defined with the @isTest annotation or the testmethod keyword
  2. The isTest(SeeAllData=true) annotation is used to open up data access when applied at the class or method leve

IsTest(OnInstall=true) Annotation

Use the IsTest(OnInstall=true) annotation to specify which Apex tests are executed during package installation. This annotation is used for tests in managed or unmanaged packages