CRM and Salesforce Overview

Customer Relationship Management (CRM) systems manage the entire customer lifecycle — from first contact through sale, support, and renewal. Salesforce dominates the CRM market with a platform that combines standard CRM functionality with a powerful customization engine. Testing Salesforce requires understanding both CRM business processes and platform-specific technical concepts.

Salesforce Architecture

  • Salesforce Clouds: Sales Cloud, Service Cloud, Marketing Cloud, Commerce Cloud — each with distinct functionality
  • Data Model: Standard objects (Lead, Account, Contact, Opportunity, Case) plus custom objects
  • Apex: Salesforce’s proprietary programming language (Java-like) for custom logic
  • Lightning: Modern UI framework replacing Visualforce
  • Flows: No-code/low-code automation replacing Process Builder and Workflow Rules
  • AppExchange: Marketplace for third-party applications and components

CRM Core Concepts

graph LR A[Lead Capture] --> B[Lead Scoring] B --> C[Assignment Rules] C --> D[Qualification] D --> E[Convert to Account + Contact + Opportunity] E --> F[Pipeline Management] F --> G[Won/Lost] G -->|Won| H[Customer Success] G -->|Lost| I[Nurture Campaign]

CRM Testing Focus Areas

Lead Management Testing

The lead-to-customer journey is the most critical CRM workflow:

  • Lead capture: Web forms, email integration, API imports, manual entry
  • Lead scoring: Automatic scoring based on engagement, demographics, firmographics
  • Assignment rules: Leads routed to correct sales rep based on territory, product interest, or round-robin
  • Deduplication: System detects and merges duplicate leads
  • Conversion: Lead becomes Account + Contact + Opportunity with correct data mapping

Opportunity Pipeline Testing

Opportunities track potential deals through sales stages:

  • Stage progression: Prospecting → Qualification → Proposal → Negotiation → Closed Won/Lost
  • Probability and expected revenue calculations at each stage
  • Required fields per stage (e.g., Proposal stage requires quote attachment)
  • Close date tracking and forecasting accuracy

Reporting and Dashboards

CRM reporting is critical for business decisions:

  • Report filters return correct data subsets
  • Dashboard charts accurately represent underlying data
  • Cross-object reports join data correctly
  • Scheduled reports deliver at the right time with fresh data

Salesforce-Specific Testing

Validation Rules

Validation rules enforce data quality at the field level:

RuleConditionExpected Error
Required phonePhone is blank when Status = “Contacted”“Phone number is required for contacted leads”
Email formatEmail does not match regex pattern“Please enter a valid email address”
Close date futureClose Date is in the past for open opportunities“Close date must be in the future”
Cross-fieldDiscount > 30% and Approval Status != “Approved”“Discounts over 30% require manager approval”

Test validation rules for:

  • Triggering on correct conditions
  • Correct error messages
  • Not firing when conditions are not met
  • Interaction with other validation rules (order of execution)

Apex Trigger Testing

Apex triggers fire on DML operations (insert, update, delete):

  • Before triggers: validate or modify data before save
  • After triggers: perform actions after save (create related records, send notifications)
  • Bulk operations: triggers must handle 200+ records in a single transaction (governor limits)
  • Recursion prevention: triggers that update records may re-fire themselves

Flow Testing

Salesforce Flows automate business processes without code:

  • Record-triggered flows: fire when records are created/updated
  • Screen flows: interactive multi-step wizards
  • Scheduled flows: batch processing on a schedule
  • Test each path through the flow, including error handling

Advanced Salesforce Testing

Salesforce DX and CI/CD

Modern Salesforce development uses source-driven development:

  • Test metadata deployment from version control to sandbox
  • Verify scratch org creation and package installation
  • Automate Apex test execution in CI pipeline
  • Test code coverage meets 75% minimum requirement for deployment

CPQ (Configure-Price-Quote) Testing

Salesforce CPQ adds complex pricing:

  • Product configuration rules (compatible options, required add-ons)
  • Pricing calculations (volume discounts, contracted prices, multi-currency)
  • Quote generation (PDF output, approval workflows, electronic signature)
  • Subscription pricing (monthly/annual, proration, renewal)

Integration Testing

Salesforce rarely operates in isolation:

  • REST/SOAP API integrations with external systems
  • Outbound messages and platform events
  • Data synchronization with ERP, marketing automation, support systems
  • SSO/SAML integration for authentication

Hands-On Exercise

Design test cases for a lead-to-cash flow:

  1. Lead capture: Web form submission creates lead with correct field mapping
  2. Auto-assignment: Lead assigned to correct rep based on territory rules
  3. Lead scoring: Engagement activities increase score; score threshold triggers alert
  4. Conversion: Lead converts to Account + Contact + Opportunity with no data loss
  5. Opportunity stages: Progress through each stage, verify required fields and automation
Solution Guide

Lead capture tests:

  • Submit form with all required fields → lead created with correct values
  • Submit form with existing email → duplicate detection fires
  • Submit form with invalid email format → validation error shown

Conversion tests:

  • Convert lead with no existing account → new Account, Contact, Opportunity created
  • Convert lead with existing account → Contact added to existing Account
  • Convert lead → verify all custom field mappings are correct
  • Convert lead → verify after-conversion triggers fire (welcome email, task creation)

Pro Tips

  1. Test with realistic data volumes — governor limits behave differently at scale than with a few test records
  2. Verify validation rules fire in correct order and do not conflict with each other
  3. Test sandbox refresh process — stale sandboxes cause environment inconsistencies
  4. Always test as different user profiles — field-level security varies by profile and permission set
  5. Automate Salesforce regression testing with tools like Provar, Copado, or Salesforce CLI

Key Takeaways

  1. CRM testing focuses on workflow accuracy and data integrity across the customer lifecycle
  2. Salesforce governor limits make scale testing essential — small-scale tests hide production failures
  3. Role-based access testing is critical — different users should see different data and have different permissions
  4. Salesforce automation (triggers, flows, validation rules) must be tested for interactions and conflicts