Saturday, 6 June 2015

Best Practice for Test classes | Sample Test class

In this post we will talk about best practice for test classes with test class examples in Salesforce. We will also talk about how to write Salesforce test class for controller, test class for Standard Controller, test class for trigger in salesforce with example.

What to Test In Apex?

Salesforce.com recommends the following components need to test.

1. Single Records: 

This includes testing to verify that a single record produces the correct, expected result

2. Bulk Records: 

Any apex code, whether a triggers, a class or on extension may be used for 1to 200 records we must test not only the single record case, but the bulk cases as well.

3. Positive scenarios: 

This type of component testing expect a system to save a record without error.

4. Negative scenarios: 

This type of component testing expect a system to give error.

5. Restricted User: 

Test whether a user with restricted access to the objects used in code sees the expected behavior, i.e whether they can run the code or receive error messages.


Here Example of Test Classes



Test Class for Trigger


@isTest 
public class TriggerTestClass 
{
    static testMethod void testMethod1() 
 {
  // Perform DML here only
 
        }
}

Test Class for Standard Controller


@isTest 
public class ExtensionTestClass 
{
 static testMethod void testMethod1() 
 {
 Account testAccount = new Account();
 testAccount.Name='Test Account record' ;
 insert testAccount;

 Test.StartTest(); 
  ApexPages.StandardController sc = new ApexPages.StandardController(testAccount);
  myControllerExtension testAccPlan = new myControllerExtension(sc);

  PageReference pageRef = Page.AccountPlan; // Add your VF page Name here
  pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
  Test.setCurrentPage(pageRef);

  //testAccPlan.save(); call all your function here
 Test.StopTest();
 }
}


Test Class for Controller class


@isTest 
public class ControllerTestClass 
{
 static testMethod void testMethod1() 
 {
 Account testAccount = new Account();
 testAccount.Name='Test Account record' ;
 insert testAccount;

 Test.StartTest(); 

  PageReference pageRef = Page.AccountPlan; // Add your VF page Name here
  pageRef.getParameters().put('id', String.valueOf(testAccount.Id));
  Test.setCurrentPage(pageRef);

  myController testAccPlan = new myController();
  
  //testAccPlan.save(); call all your function here
 Test.StopTest();
 }
}


Test Class for StandardSetController


@isTest 
public class TestStandardSetController 
{
 static testMethod void testMethod1() 
 {
 List <Account> lstAccount = new List<Account>();
 
 Account testAccount = new Account();
 testAccount.Name='Test Account' ;
 lstAccount.add(testAccount);
 Account testAccount1 = new Account();
 testAccount1.Name='Test Account11' ;
 lstAccount.add(testAccount1);

 insert  lstAccount;
 
 Test.startTest();
  Test.setCurrentPage(Page.YOUR_PAGE);
  ApexPages.StandardSetController stdSetController = new ApexPages.StandardSetController(lstAccount);
  stdSetController.setSelected(lstAccount);
  YOUR_Extension ext = new YOUR_Extension(stdSetController);
 Test.stopTest();
 }
}



Please follow below salesforce Best Practice for Test Classes :-


1. Test class must start with @isTest annotation if class class version is more than 25
2. Test environment support @testVisible, @testSetup as well
3. Unit test is to test particular piece of code working properly or not .
4. Unit test method takes no argument, send no email ,
commit no data to database and flagged with testMethod keyword .
5. To deploy to production at least 75% code coverage is required
6. Test method and test classes are not counted as a part of code limit
7. System.debug statement are not counted as a part of apex code limit.8. We should not focus on the  percentage of code coverage ,we should make sure that every use case should covered including positive, negative,bulk and single record .
  • Single Action -To verify that the the single record produces the correct an expected result .
  • Bulk action -Any apex record trigger ,class or extension must be invoked for 1-200 records .
  • Positive behavior : Test every expected behavior occurs through every expected permutation , i,e user filled out every correctly data and not go past the limit .
  • Negative Testcase :-Not to add future date , Not to specify negative amount.
  • Restricted User :-Test whether a user with restricted access used in your code .
9. Test class should be annotated with @isTest .
10 . @isTest annotation with test method  is equivalent to testMethod keyword .
11. Test method should static and no void return type .

12. Test class and method default access is private ,no matter to add access specifier .
13. Classes with @isTest annotation can't be a interface or enum .
14. Test method code can't be invoked by non test request .
15. Stating with salesforce API 28.0 test method can not reside inside non test classes .
16. @Testvisible annotation to make visible private methods inside test classes.
17. Test method can't be used to test web-service call out . Please use call out mock .
18. You can't  send email from test method.

19.User, profile, organization, AsyncApexjob, Corntrigger, RecordType, ApexClass, ApexComponent ,ApexPage we can access without (seeAllData=true) .
20. SeeAllData=true will not work for API 23 version eailer .
21. Accessing static resource test records in test class e,g List<Account> accList=Test.loadData(Account,SobjectType,'ResourceName').
22. Create TestFactory class with @isTest annotation to exclude from organization code size limit .
23. @testSetup to create test records once in a method  and use in every test method in the test class .
24. We can run unit test by using Salesforce Standard UI,Force.com IDE ,Console ,API.
25. As apex runs in system mode so the permission and record sharing are not taken into account . So we need to use system.runAs to enforce record sharing .
26. System.runAs will not enforce user permission or field level permission .
27. Every test to runAs count against the total number of DML issued in the process .



Please check below post to learn more about test classes.
 
 



Please let us know if this post will help you


Thanks
Amit Chaudhary

Thursday, 4 June 2015

Salesforce Testing Best Practice Guidelines | Unit Test Mechanism in Salesforce | Test Methods


Unit Test Mechanism in Salesforce

1) Single action

Test to verify that a single record produces the correct, expected result. So created the unit test data in your test class.

2) Bulk actions

Any Apex code, whether a trigger, a class or an extension, may be invoked for 1 to 200 records. You must test not only the single record case, but the bulk cases as well.

3) Restricted user

Test whether a user with restricted access to the sObjects used in your code sees the expected behavior. That is, whether they can run the code or receive error messages. Always use RunAs for to check user access on sObjects.

4) Positive behaviour

Test to verify that the expected behaviour occurs through every expected permutation, that is, that the user filled out everything correctly and did not go past the limits.

5) Negative behaviour

There are likely limits to your applications, such as not being able to add a future date, not being able to specify a negative amount, and so on. You must test for the negative case and verify that the error messages are correctly produced as well as for the positive, within the limits cases.

Test Methods

1) Apply testMethod or @isTest to methods

      • Demarcates a single self-contained test

public class MyClass 
{
  @isTest  
    private static void myTest() 
   {
      // code block
   }
}


2) Apply @isTest to classes

• Optional: test methods may also be contained in public classes
• Won’t count against the 2MB/org Apex code limit
– @isTest methods will not be shown in code coverage results
• The class must be marked as private
• Public methods can’t be called from outside the class


@isTest 
private class MyTestClass 
{
   @isTest private static void myTest() 
   {
 // code block
   }
}




Apex tests will not:

  1.  Commit changes to the database.
  2.  But SOQL queries will find records created during the test.
  3.  Perform callouts to external Web services.
  4.  Send outbound email.
  5.  Return results from SOSL searches.

Test Requirements in Production
  1. 75% of Apex statements must be executed (strive for 100% code coverage)
  2. All Apex triggers must be called. 
  3. All Apex tests must execute without throwing any uncaught exceptions or exceeding governors.


Step 1: Positive Path

Verify that when passed valid inputs, called code completes without throwing an exception.

Step 2: End state
  • Verify data-defined outcomes with assertions
  • System.assert()
  • System.assertEquals()
  • System.assertNotEquals()

Step 3: Negative Path

Verify that when passed invalid inputs, exceptions are properly handled

Step 4: Governors
  • Verify that code is bulk ready.
  • Pass up to 200 records.
  • Trade-off between test performance and effectiveness


Please let us know if this post will help you.


Thanks,
Amit Chaudhary


Monday, 1 June 2015

Trigger Best Practices | Sample Trigger Example | Implementing Trigger Framework


1) One Trigger Per Object

A single Apex Trigger is all you need for one particular object. If you develop multiple Triggers for a single object, you have no way of controlling the order of execution if those Triggers can run in the same contexts

2) Logic-less Triggers

If you write methods in your Triggers, those can’t be exposed for test purposes. You also can’t expose logic to be re-used anywhere else in your org.

3) Context-Specific Handler Methods

Create context-specific handler methods in Trigger handlers

4) Bulkify your Code

Bulkifying Apex code refers to the concept of making sure the code properly handles more than one record at a time.

5) Avoid SOQL Queries or DML statements inside FOR Loops

An individual Apex request gets a maximum of 100 SOQL queries before exceeding that governor limit. So if this trigger is invoked by a batch of more than 100 Account records, the governor limit will throw a runtime exception

6) Using Collections, Streamlining Queries, and Efficient For Loops

It is important to use Apex Collections to efficiently query data and store the data in memory. A combination of using collections and streamlining SOQL queries can substantially help writing efficient Apex code and avoid governor limits

7) Querying Large Data Sets

The total number of records that can be returned by SOQL queries in a request is 50,000. If returning a large set of queries causes you to exceed your heap limit, then a SOQL query for loop must be used instead. It can process multiple batches of records through the use of internal calls to query and queryMore

8) Use @future Appropriately

It is critical to write your Apex code to efficiently handle bulk or many records at a time. This is also true for asynchronous Apex methods (those annotated with the @future keyword). The differences between synchronous and asynchronous Apex can be found

9) Avoid Hardcoding IDs

When deploying Apex code between sandbox and production environments, or installing Force.com AppExchange packages, it is essential to avoid hardcoding IDs in the Apex code. By doing so, if the record IDs change between environments, the logic can dynamically identify the proper data to operate against and not fail

Always remember below points before writing trigger :-
1) Order Of Execution
2) Recursive Trigger
3) Learn about Other Trigger Framework with Recording

Here is sample code for Trigger Handler framework Code :-

Create one Trigger "AccountTrigger"

trigger AccountTrigger on Account( after insert, after update, before insert, before update)
{

    AccountTriggerHandler handler = new AccountTriggerHandler(Trigger.isExecuting, Trigger.size);
    
    if( Trigger.isInsert )
    {
        if(Trigger.isBefore)
        {
            handler.OnBeforeInsert(trigger.New);
        }
        else
        {
            handler.OnAfterInsert(trigger.New);
        }
    }
    else if ( Trigger.isUpdate )
    {
        if(Trigger.isBefore)
        {
            handler.OnBeforeUpdate(trigger.New ,trigger.Old,Trigger.NewMap,Trigger.OldMap);
        }
        else
        {
            handler.OnAfterUpdate(trigger.New ,trigger.Old,Trigger.NewMap,Trigger.OldMap);
        }
    }
}

Create one Trigger Handler Class

public with sharing class AccountTriggerHandler 
{
    private boolean m_isExecuting = false;
    private integer BatchSize = 0;
    public static boolean IsFromBachJob ;
    public static boolean isFromUploadAPI=false;
    
    public AccountTriggerHandler(boolean isExecuting, integer size)
    {
        m_isExecuting = isExecuting;
        BatchSize = size;
    }
            

    public void OnBeforeInsert(List<Account> newAccount)
    {
        system.debug('Account Trigger On Before Insert');
    }
    public void OnAfterInsert(List<Account> newAccount)
    {
        system.debug('Account Trigger On After Insert');
    }
    public void OnAfterUpdate( List<Account> newAccount, List<Account> oldAccount, Map<ID, Account> newAccountMap , Map<ID, Account> oldAccountMap )
    {
        system.debug('Account Trigger On After Update ');
        AccountActions.updateContact (newAccount);
    }
    public void OnBeforeUpdate( List<Account> newAccount, List<Account> oldAccount, Map<ID, Account> newAccountMap , Map<ID, Account> oldAccountMap )
    {
        system.debug('Account Trigger On Before Update ');
    }

    @future 
    public static void OnAfterUpdateAsync(Set<ID> newAccountIDs)
    {

    }      
    public boolean IsTriggerContext
    {
        get{ return m_isExecuting;}
    }
    
    public boolean IsVisualforcePageContext
    {
        get{ return !IsTriggerContext;}
    }
    
    public boolean IsWebServiceContext
    {
        get{ return !IsTriggerContext;}
    }
    
    public boolean IsExecuteAnonymousContext
    {
        get{ return !IsTriggerContext;}
    }
} 

Create one Trigger Action Class



public without sharing class AccountActions 
{
    public static void updateContact ( List<Account> newAccount)
    {
        // Add your logic here
    }
}

Source of link :-

https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices
https://developer.salesforce.com/page/Apex_Code_Best_Practices
http://amitsalesforce.blogspot.in/2015/03/how-to-stop-recursive-trigger-in.html
http://amitsalesforce.blogspot.in/2015/01/triggers-and-order-of-execution.html


Thanks,
Amit Chaudhary


Tuesday, 19 May 2015

REST API | New Resources | Summer 15 | Composite Resources in Salesforce

Composite Resources
Salesforce introduces two composite resources for improving your application’s performance by minimizing the number of round trips between client and server.

Batch
vXX.X/composite/batch
The Batch resource lets you execute a sequence of independent subrequests. For example, you can update the name on an account and get the account’s field values in a single request

{
"batchRequests" : [
    {
    "method" : "PATCH",
    "url" : "v34.0/sobjects/account/001D000000K0fXOIAZ",
    "richInput" : {"Name" : "NewName"}
    },{
    "method" : "GET",
    "url" : "v34.0/sobjects/account/001D000000K0fXOIAZ"
    }]
} 
The response contains the status codes of each subresponse and the responses themselves.
{   
"hasErrors" : false,
"results" : [
    {     
    "statusCode" : 204,
    "result" : null
    },{
    "statusCode" : 200,
    "result" : { Account attributes }
    }] 
}

The Batch resource supports batching for the following resources and resource groups

Versions/
Resources by VersionvXX.X
Limits
vXX.X/limits
SObject resources
vXX.X/sobjects/
Query
vXX.X/query/?q=soql
QueryAll
vXX.X/queryAll/?q=soql
Search
vXX.X/search/?q=sosl
Connect resources
vXX.X/connect/
Chatter resources
vXX.X/chatter/
SObject Tree
vXX.X/composite/tree


NOTE:- It won't work, but that's because it will not be available until version 34 of the API.
But if you get a pre-release org, you can do the same with the updated API version

Source of Link :-
http://releasenotes.docs.salesforce.com/en-us/summer15/release-notes/rn_api_rest.htm
https://help.salesforce.com/apex/HTViewSolution?id=000214070&language=en_US
https://help.salesforce.com/apex/HTViewSolution?id=000214070&language=en_US
http://salesforce.stackexchange.com/questions/76155/rest-api-version-where-is-it-defined-what-are-the-consequences-for-updating 


<<PREVIOUS       NEXT>>





Thursday, 7 May 2015

Creating a sales invoice with financial force (no current company)


Problem :-  Creating a sales invoice with financial force

How to set Current Company by UI:-

Go to a non-setup page where you can see the left sidebar. The left sidebar near the top should show your 'current company'. 




If you have no 'current company',  a link saying 'Current Company not set' should appear there instead.
Click on the link and select a company from the list of companies that you have created.


Then create your invoice(s) as required

Test Class for Sales Invoice in Financial Force ( How to set current company by Code ) :-

@isTest 
private class salesInvoiceTestClass
{
 static testMethod void salesInvoiceTest() 
 {
 Group testGroup = new Group(Name='test group', Type='Queue');
 insert testGroup;
 QueuesObject testQueue ; 
 System.runAs(new User(Id=UserInfo.getUserId()))
 {
     List<queuesobject >  listQueue = new List<queuesobject >();
   queuesobject q1 = new queuesobject (queueid=testGroup.id, sobjecttype='Case'); 
   listQueue.add(q1);
   queuesobject q2 = new queuesobject (queueid=testGroup.id,                                                                 sobjecttype='c2g__codaAccountingCurrency__c'); 
   listQueue.add(q2);
   queuesobject q3 = new queuesobject (queueid=testGroup.id,                                                                 sobjecttype='c2g__codaPurchaseInvoice__c'); 
   listQueue.add(q3);
   queuesobject q4 = new queuesobject (queueid=testGroup.id, sobjecttype='c2g__codaCompany__c'); 
   listQueue.add(q4);
   queuesobject q5 = new queuesobject (queueid=testGroup.id, sobjecttype='c2g__codaYear__c'); 
   listQueue.add(q5);
   queuesobject q6 = new queuesobject (queueid=testGroup.id, sobjecttype='c2g__codaInvoice__c'); 
   listQueue.add(q6);
   insert  listQueue;

   GroupMember GroupMemberObj = new GroupMember();
   GroupMemberObj.GroupId = testGroup.id;
   GroupMemberObj.UserOrGroupId = UserInfo.getUserId();
   insert GroupMemberObj;
 }        

 c2g__codaCompany__c company = new c2g__codaCompany__c();
 company.Name = 'Test Record';
 company.JDE_Company_Code__c = '123';
 company.GLS_JE_Group_Number__c = '123' ;
 company.c2g__CashMatchingCurrencyMode__c = 'Test Account';
 company.c2g__YearEndMode__c = 'Test Code';
 company.c2g__ExternalId__c = 'ABCDE1234567876';
 company.c2g__LogoURL__c ='ww.XYZ.com';
 company.c2g__ECCountryCode__c = 'AE' ;
 company.c2g__VATRegistrationNumber__c = 'Test 222.222.222 TVA' ;
 company.c2g__Website__c = 'ww.xyz.com';
 company.c2g__Country__c ='US';
 company.ownerid = testGroup.Id;
 insert company;

 c2g__codaYear__c yr= new c2g__codaYear__c();
 yr.Name ='2015';
 yr.c2g__AutomaticPeriodList__c =  true;
 yr.c2g__OwnerCompany__c = company.id;
 yr.c2g__ExternalId__c = 'yzsd1234';
 yr.c2g__NumberOfPeriods__c =11;
 yr.c2g__StartDate__c =  system.today() - 10;
 yr.c2g__Status__c = 'Open';
 yr.c2g__PeriodCalculationBasis__c = '445';
 yr.c2g__YearEndMode__c = 'Full Accounting Code' ; 
 yr.c2g__UnitOfWork__c = 12;
 yr.ownerid = testGroup.Id;
 insert yr;

 c2g__codaPeriod__c prd = new c2g__codaPeriod__c();
 prd.Name ='Test2015';
 prd.c2g__ExternalId__c ='abdc12345';
 prd.c2g__StartDate__c = System.today()-10;
 prd.c2g__EndDate__c= System.today()+10;
 prd.c2g__OwnerCompany__c = company.id;
 prd.c2g__PeriodNumber__c ='123';
 prd.c2g__Description__c ='test Desc';
 prd.c2g__PeriodGroup__c = 'Q1';
 prd.c2g__PeriodNumber__c = '1';
 prd.c2g__YearName__c = yr.id;
 insert prd;

 c2g__codaUserCompany__c userCompany = new c2g__codaUserCompany__c();
 userCompany.c2g__Company__c =company.id;
 userCompany.c2g__User__c = userInfo.getUserId();
 userCompany.c2g__ExternalId__c = 'ABCDE1234567876';
 userCompany.c2g__UnitOfWork__c = 111 ;
 insert  userCompany;

 c2g__codaAccountingCurrency__c accCurrency = new c2g__codaAccountingCurrency__c();
 accCurrency.c2g__OwnerCompany__c = company.id;
 accCurrency.c2g__DecimalPlaces__c = 2;
 accCurrency.Name = 'AED';
 accCurrency.c2g__Dual__c = true ;
 accCurrency.ownerid = testGroup.Id;
 insert accCurrency;

 c2g__codaExchangeRate__c exchRate = new c2g__codaExchangeRate__c();
 exchRate.c2g__ExchangeRateCurrency__c = accCurrency.id;
 exchRate.c2g__OwnerCompany__c = company.id;
 exchRate.c2g__ExternalId__c ='12323232';
 exchRate.c2g__Rate__c =44.55;
 exchRate.c2g__StartDate__c = system.today()-10;
 exchRate.c2g__UnitOfWork__c =10;
 insert exchRate;       

 c2g__codaGeneralLedgerAccount__c GLAcc = new c2g__codaGeneralLedgerAccount__c();
 GLAcc.Name = 'Retained Earnings';
 GLAcc.c2g__BalanceSheet1__c ='Balance Sheet'; 
 GLAcc.Description__c ='test Desc';
 GLAcc.c2g__ExternalId__c ='testID';
 GLAcc.Account_Level__c = 'CAB';
 GLAcc.Business_Unit__c = 'RG';
 GLAcc.c2g__ReportingCode__c = '1234567543333';
 GLAcc.c2g__UnitOfWork__c =123;
 GLAcc.Reconciliation_Frequency__c ='Quarterly';
 GLAcc.c2g__TrialBalance1__c = 'Balance Sheet' ;
 GLAcc.c2g__Type__c = 'Balance Sheet' ;
 GLAcc.X10_Digit_GLA__c = false;
 insert GLAcc;

 Account acc= new Account();
 acc.Name='Test Account';
 acc.Account_Currency__c='USD';
 acc.CurrencyIsoCode='USD';
 acc.c2g__CODAAccountsPayableControl__c = GLAcc.Id;
 insert acc;

 c2g__codaInvoice__c testInvoice = new c2g__codaInvoice__c();
 testInvoice.CurrencyIsoCode = 'USD'
 testInvoice.c2g__InvoiceDate__c = date.today().addDays(-7)
 testInvoice.c2g__DueDate__c = date.today().addDays(-7)
 testInvoice.c2g__Account__c = acc.Id
 testInvoice.c2g__OwnerCompany__c = company.id
 testInvoice.ownerid = testGroup.Id
 insert testInvoice;            
 }  
}



Problem link :- https://developer.salesforce.com/forums/ForumsMain?id=906F000000092RnIAI





Monday, 4 May 2015

@testSetup ( Set Up Test Data for an Entire Test Class )

Use test setup methods (methods that are annotated with @testSetup) to create test records once and then access them in every test method in the test class. Test setup methods can be time-saving when you need to create reference or prerequisite data for all test methods, or a common set of records that all test methods operate on.

Test setup methods can reduce test execution times especially when you’re working with many records. Test setup methods enable you to create common test data easily and efficiently. By setting up records once for the class, you don’t need to re-create records for each test method. Also, because the rollback of records that are created during test setup happens at the end of the execution of the entire class, the number of records that are rolled back is reduced. As a result, system resources are used more efficiently compared to creating those records and having them rolled back for each test method

@isTest
private class CommonTestSetup 
{
 @testSetup 
 static void setup() 
 {
  Account acct = new Account();
       acct.Name = 'Salesforce.com';
       acct.Industry = 'Technology';
  insert acct;
  
  Contact cont = new Contact();
       cont.FirstName = 'Amit';
       cont.LastName = 'Chaudhary';
       cont.AccountId = acct.Id;
  insert cont;
 }
    
 @isTest 
 static void testMethod1() 
 {
  Account acct = [SELECT Id FROM Account WHERE Name='Salesforce.com' LIMIT 1];
     acct.Phone = '555-1212';
  update acct;
 }

 @isTest 
 static void testMethod2() 
 {
  Account acct = [SELECT Phone FROM Account WHERE Name='Salesforce.com' LIMIT 1];
  System.assertEquals(null, acct.Phone);
 }
}

NOTE:-
  1. If a test class contains a test setup method, the test setup method executes first, before any test method in the class
  2. Multiple @testSetup methods are allowed in a test class, but the order in which they’re executed by the testing framework isn’t guaranteed
  3. If the test class or a test method has access to organization data by using the @isTest(SeeAllData=true) annotation, test setup methods aren’t supported in this class.
  4. Available for API versions 24.0 and later
  5. If a fatal error occurs during the execution of a test setup method, such as an exception that’s caused by a DML operation or an assertion failure, the entire test class fails, and no further tests in the class are executed
  6. If a test setup method calls a non-test method of another class, no code coverage is calculated for the non-test method
  7. If a test method changes those records, such as record field updates or record deletions, those changes are rolled back after each test method finishes execution. The next executing test method gets access to the original unmodified state of those records



Thanks
Amit Chaudhary


Friday, 1 May 2015

SALESFORCE SUMMER ‘15 RELEASE NOTES






The Summer’15 release of Salesforce.com is now in available under pre-release program. In May Sandboxes will be upgraded so that your organization gets the look and feel of Summer’15 release

Customer/User’s Point of view


1) Data Loader for Mac

The Data Loader, an easy-to-use graphical tool that helps you import, export, update, and delete Salesforce data, is now available for Mac OS X.

To download the Mac version, from Setup, click Data Management > Data Loader




2) Choose the Logout Page for Salesforce Users

Direct users to a specific logout destination that maintains your own branding experience after they log out of Salesforce. Or, send them to a specific authentication provider’s page

From Setup, go to Security Controls > Session Settings. Set the Logout Page Settings to provide the URL of the custom logout page. If none is provided, the default is https://login.salesforce.com unless MyDomain is enabled. If My Domain is enabled, the default is https://customdomain.my.salesforce.com

3) Convert Leads to Contacts (Generally Available)

Sales representatives on the go can convert qualified leads to contacts, as well as create accounts and opportunities. This option is available in all versions of Salesforce1.

It’s easy to make this option available to your sales reps. From Setup in the full Salesforce site, click Customize > Leads > Settings, and then select the option to enable conversions on the Salesforce1
app.


4) Support Updating Picklist Fields Using Formulas

When your process updates fields, you can now use formulas and date functions as the value

5) Setup Assistant for Newly Activated Organizations

Setup Assistant helps you import data and customize your sales stages—all through easy-to-use wizards. And we’ve included helpful videos to get you and your teams on the way to increasing sales in Salesforce

6) Create or Edit Records Owned by Inactive Users

Previously, only administrators were able to edit accounts, opportunities, and custom object records that are owned by inactive users. With Spring ’15, administrators and all users with the create or edit permission can create or edit accounts, opportunities, and custom object records that are owned by inactive users. For example, you can edit the Account Name field on an opportunity record that is owned by an inactive user

7) Set Up Test Data for an Entire Test Class

Use test setup methods (methods that are annotated with @testSetup) to create test records once and then access them in every test method in the test class. Test setup methods can be time-saving when you need to create reference or prerequisite data for all test methods, or a common set of records that all test methods operate on.

Test setup methods are defined in a test class, take no arguments, and return no value. The following is the syntax of a test setup method.
@testSetup static void methodName() {

}

@isTest
private class CommonTestSetup {

    @testSetup static void setup() {
        // Create common test accounts
        List<Account> testAccts = new List<Account>();
        for(Integer i=0;i<2;i++) {
            testAccts.add(new Account(Name = 'TestAcct'+i));
        }
        insert testAccts;        
    }
    
    @isTest static void testMethod1() {
        // Get the first test account by using a SOQL query
        Account acct = [SELECT Id FROM Account WHERE Name='TestAcct0' LIMIT 1];
        acct.Phone = '555-1212';
        update acct;
       
       Account acct2 = [SELECT Id FROM Account WHERE Name='TestAcct1' LIMIT 1];
       delete acct2;
        
    }                                                                          }

8) Enforce IP Addresses in Login IP Ranges

The Enforce login IP ranges on every request Session Settings option restricts the IP addresses from which users can access Salesforce to only the IP addresses defined in Login IP Ranges. This option affects all user profiles that have login IP restrictions

  • From Setup, click Security Controls | Session Settings
  • Select Enforce login IP ranges on every request

9) Administrators Can Log in as Any User

Administrators with “Modify All Data” permission and delegated administrators with “View Setup and Configuration” permission can log in as any user without asking end users to grant access. Previously, this option was available only if Salesforce enabled the Administrators Can Log in as Any User setting for your organization. To disable this feature, contact Salesforce.



Relates Link :-

1) https://developer.salesforce.com/releases/release/Summer15
2) http://docs.releasenotes.salesforce.com/en-us/spring15/release-notes/salesforce_release_notes.htm