Salesforce Testing Explained.

1. What is Salesforce Testing?

Salesforce testing is the process of verifying a Salesforce customization and configuration with the purpose of identifying any errors, gaps or missing requirements versus the actual requirement. Testing is important to make sure that the delivered functionality meets the user requirement. Testing helps to identify and fixe any possible bugs in the application before it goes live.

2. Salesforce Testing Life Cycle

There are five stages of Salesforce Testing Life Cycle:

  1. Requirement Gathering – Understand the business requirements of the application being built.
  2. Test Planning – Define test strategy, objectives and test plan
  3. Test Environment Setup – Get access to a Salesforce sandbox and setup test data.
  4. Test Execution – Execute the test cases and document any bugs identified.
  5. Test Closure – Document test summary once all test cases has been executed and identified defects fixed.

3. Types of Salesforce Testing

Salesforce testing is broadly categorized into two types:

  1. Functional testing
  2. Non-functional testing

Salesforce Testing can be Manual or Automated.

4. Salesforce Functional Testing

Functional Testing tests whether the application being developed meets the functional requirements captured in the requirement document or User Stories. Functional Testing can be divided into following components:

  • Unit Testing – Individual units of code and configurations are testing to determine whether they meeting the expected requirement.
  • Integration Testing – Individual modules are combined and tested as a group.
  • System Testing – End to end testing of complete integrated system to evaluate systems compliance with the specified requirements.
  • User Acceptance Testing – Testing performed by end user or customers.

5. Salesforce Non-Functional Testing

Non-Functional Testing evaluates the performance, usability and reliability of the application. Non-Functional Testing can be divided into following components.

  • Performance – Testing to determine how a system performs in terms of responsiveness and stability under a particular workload.
  • Security – Testing intended to reveal flaws in the security mechanisms of an information system that protect data and maintain functionality as intended
  • Usability – Testing to evaluate how easy is it to use the application from end user perspective.
  • Compatibility – Testing to ensure the application’s compatibility with different computing environment. 

6. Salesforce Testing Best Practices

Some of the Salesforce Testing Best Practices are:

  • Testing using different Profiles and Roles – Tester should login as different users to test the application and some of the features may not behave the same when testing using a non System Admin User.
  • Appropriate Sandbox – System and Performance Testing should be conducted in Full Copy Sandbox
  • Enabled Debug Logs – Testers should enable debug logs while testing because some of the errors may not show up on screen but are logged in debug logs. Such errors should also be logged as a Bug and fixed accordingly.
  • Setup Apex Exception Email – Testers should add their email in Apex Exception Email because some of the errors may not show up on screen but they will be notified in the email. Such errors should also be logged as a Bug and fixed accordingly.

7. Apex Test Class Best Practices

Some the Apex Test Class Best Practices are:

  • Aim for 95% Code Coverage – Although Salesforce requires 75% it is a best practice to have more than 95% code coverage.
  • Use System.assert – Use System.assert method to validate that code is behaving as expected.
  • Use RunAs – Use RunAs method to test your application using different user contexts.
  • Bulk Testing – Use at-least 20 records in your tests.
  • Test Data – Create test data in test classes instead of using actual org’s data for testing.
  • Use startTest and stopTest – Use startTest and stopTest in the test methods

8. Additional Resources

This is a developing article and will be updated soon!

Recommended Articles

Tags:

Please Leave a Comment