Jon Robinson
The SSX Method for Salesforce Testing
As a front-runner in the CRM domain, Salesforce provides its users with a plethora of customization opportunities to tailor the platform to their unique business needs. These personalization features, ranging from simple field modifications to intricate automation workflows, have been instrumental in making Salesforce the go-to solution for businesses worldwide. However, this degree of customization also underscores the importance of rigorous testing. Ensuring that these bespoke configurations and functionalities operate seamlessly within the broader ecosystem becomes paramount to maintain the platform's integrity and achieve the desired business outcomes. Automation is frequently suggested for Salesforce testing, but it's crucial to be selective. Enter the Scope, Scripting, & eXecution (SSX) approach.
Scope
Starting your Salesforce testing journey can be quite daunting. The vast nature of Salesforce and the tailored modifications each organization makes mean there's no one-size-fits-all approach. However, establishing clear criteria on what to include and exclude can significantly de-clutter the process. Let’s dive a little deeper into what that looks like:
Out of Scope:
1. Tests on standard Salesforce UI elements.
Rationale: The basic user interface (UI) components provided by Salesforce are consistently reliable. Salesforce’s own quality assurance ensures that these elements function correctly. Instead of doubling up on this effort, it's more practical to trust Salesforce's native functionality, unless you've made specific customizations.
Example: Testing the basic functionality of the 'Opportunity' creation page, which is a staple of Salesforce CRM, isn't necessary. However, if you've made specific visual modifications or added custom fields, those areas would require attention.
2. Short-duration manual tests.
Rationale: Some tests, although vital, are quicker to execute manually than the time it would take to automate, maintain, and review their results. The automation ROI for these tests might not justify the effort.
Example: Manually verifying the presence of a custom field on a page layout after a new Salesforce release can often be quicker than automating it, especially if it's a one-off requirement.
3. Infrequent custom object/field tests.
Rationale: Custom objects or fields that rarely undergo changes might not warrant frequent automated testing. Here, the frequency and impact of change dictate the need.
Example: If there's a custom object capturing annual event data, the testing frequency can be minimized compared to other regularly updated objects.
4. Tests with unpredictable outcomes due to Salesforce updates.
Rationale: Salesforce, being a dynamic platform, rolls out updates multiple times a year. If certain tests tend to break or provide inconsistent results due to these updates, their automation might not be beneficial.
Example: Features that are in Salesforce’s Beta might be unstable and could change between releases, so tests around such features might not be ideal for automation.
In Scope:
1. Custom functionality tests.
Rationale: Custom functionalities, tailor-made for an organization's needs, won't be part of Salesforce's in-house testing. These become prime areas to focus on as they carry business-specific logic and impact.
Example: If your sales process includes a unique lead assignment rule based on a custom algorithm, this process requires thorough automated testing to ensure accuracy and efficiency.
2. Lengthy manual Salesforce workflow tests.
Rationale: Complex Salesforce workflows, especially those spanning multiple objects or steps, can be time-consuming and error-prone when tested manually. Automation ensures that every nuance of the workflow is verified efficiently.
Example: An end-to-end sales process, starting from lead capture to opportunity closure, with various branching conditions and approvals, would be a prime candidate for automation.
3. Tests for frequently modified objects or integrations.
Rationale: Elements that are frequently updated or tweaked pose a higher risk of introducing errors. Having them under the ambit of automated tests ensures issues are spotted promptly.
Example: Integration points between Salesforce and an external ERP system, especially if it's continually enhanced or modified, would benefit from automated regression testing.
4. Tests with consistent outcomes regardless of Salesforce version.
Rationale: Tests that are resilient to Salesforce updates and consistently deliver expected results are valuable in an automated suite. They provide a stable foundation and require minimal maintenance.
Example: Validations ensuring data integrity between related records, like Accounts and Contacts, would typically remain consistent across Salesforce versions.
To sum up, by distinguishing between tests that are essential for automation and those better suited for manual checks, you craft a more efficient and streamlined testing strategy for your Salesforce setup. This not only ensures thorough coverage but also optimizes resource allocation and time.
Scripting
Scripting is the foundation of test automation, and when it comes to Salesforce, scripting against a shifting backdrop of frequent changes can become a Sisyphean task. Let’s take a deeper look into why scripting at the right time and with the right approach is imperative:
Finalize Customizations First
Before diving into the world of scripting, it's essential to have a stabilized Salesforce environment.
Why it Matters: Scripting against a continually changing environment can lead to frequent test breakages, making the maintenance overhead high. If a script is written for a feature and that feature undergoes change or removal, the time spent on the initial scripting becomes wasted effort.
Example: Suppose you scripted tests for a custom Salesforce Lightning component, but then the business decides to replace it with a different functionality. Your scripted test would need complete rework, costing additional time and effort
Choose the Right Scripting Method
Salesforce offers various avenues for scripting tests:
Apex Testing: Salesforce's native testing framework. Useful for unit tests, especially for developers already familiar with Apex code.
Third-party Salesforce Testing Tools: Tools like Provar, Selenium, and others offer more extensive and flexible test automation capabilities, ideal for end-to-end and integration tests.
Factors to Consider:
Complexity: How intricate is your Salesforce setup? The more complex, the more you might lean towards robust third-party tools.
Integration: If Salesforce integrates with other systems, a tool that can span platforms might be more suitable.
Maintenance: Some tools have more straightforward refactoring processes, which is crucial if changes are frequent.
ROI: The Overlooked Cornerstone
The Return on Investment (ROI) is the heart of any automation strategy.
Why ROI Matters: Scripting is time-intensive. Each script requires design, development, maintenance, and periodic reviews. If a scripted test isn't providing value (e.g., it rarely detects issues, runs infrequently, or is constantly broken due to changes), the resources spent on it may not justify its existence.
Striking a Balance: While it's tempting to automate everything, it's essential to weigh the benefits against the costs. A test that runs frequently, covers critical paths, and is stable across changes offers high ROI. Conversely, a test that requires frequent maintenance, or checks low-impact areas, might be a candidate for de-prioritization or manual testing.
Common Pitfalls
Over-automation: Avoid the allure of scripting everything. Focus on critical business paths, frequently used features, and areas prone to defects.
Ignoring Maintenance: Scripting isn’t a one-and-done endeavor. Salesforce undergoes multiple updates a year. Tests will need periodic updates to stay relevant.
Neglecting Feedback Loops: Engage with your Salesforce users and developers. Their insights on what's crucial and what's changing can be invaluable for your automation strategy.
The act of scripting tests for Salesforce isn't just about writing the script; it's about understanding the landscape, foreseeing changes, and ensuring that every script adds value to your overall testing strategy. Proper planning, timely execution, and consistent evaluation are the keys to a successful Salesforce automation approach.
eXecution
Salesforce consistently demonstrates its dedication to advancement through its regular tri-annual updates. These iterative enhancements introduce a slew of new features, tools, and improvements tailored to optimize the user experience. However, on the flip side, this ever-evolving landscape, while beneficial in many aspects, brings with it a set of intricate challenges, especially when it comes to test automation. Testing teams often find themselves in a race against time, trying to ensure that their testing strategies align with the latest Salesforce developments, all while ensuring that existing functionalities remain robust and unaffected.
Understanding Salesforce's Evolving Nature
The inherent nature of Salesforce's commitment to progressive enhancements and user-centricity often means that the ground beneath might shift - sometimes subtly, sometimes substantially. This evolving nature results in both opportunities and challenges.
Anticipate Changes: Salesforce's pre-release notes are a lifeline. They provide a preview into the platform's direction, allowing testing teams to forecast potential impacts on existing setups. It's not just about anticipating failures; it's about understanding where new testing opportunities might arise.
Test Adaptability: Salesforce is not a static platform, and neither can be your tests. Creating tests that are modular and adaptable can drastically reduce the effort when updates roll out. Consider segmenting tests to allow for easy updates to individual components, rather than overhauling entire test cases.
Engage with the Community: Salesforce has a robust community of users, developers, and testers. Engaging with this community can provide insights into common challenges post-updates, shared best practices, and even solutions to testing conundrums that you might be facing.
Consistency in Test Execution
Being consistent in running regression tests is your safety net against any unforeseen consequences arising from updates or customizations.
Frequency Matters: Balancing between resource consumption and thoroughness is key. While daily runs can provide insights into day-to-day changes, weekly runs can be more comprehensive for environments that experience fewer changes.
Automation as an Ally: Automation isn't just about efficiency; it's about consistency. Leveraging tools to automate test schedules ensures that no test window is missed.
Documentation and Reporting
Documenting isn't merely an administrative task; it's an integral part of the testing strategy.
Salesforce Reports: Utilizing Salesforce's native tools can offer valuable insights, especially when your tests correlate directly with Salesforce functionalities.
External Platforms & Test Management Tools: Integrating with platforms like JIRA or TestRail can provide richer analytics and foster collaboration.
Value of Historical Data: Accumulating test data over time can be a treasure trove. It can shed light on patterns, recurrent challenges, or even areas of the system that might need more robust testing.
Being Mindful of Salesforce's Unique Constraints
Every platform has its quirks, and Salesforce is no exception with its API call limits and governor constraints.
Strategizing around API Call Limits: A cap on daily API calls means planning tests to be efficient. Minimizing unnecessary calls, especially during setup or teardown, can be pivotal.
Governor Limits: Salesforce's governor limits are designed to ensure fairness in resource utilization. Being aware of these when scripting, especially during bulk data operations, can save hours of troubleshooting.
Navigating Bulk Data Tests: Testing in large data environments is a unique challenge. Running these tests during non-peak hours or at lower frequencies can ensure they don't bog down the overall testing process.
In essence, Salesforce testing demands both a strategic and adaptive approach. Embracing the platform's dynamic nature, maintaining execution regularity, meticulously documenting, and understanding Salesforce's nuances are all instrumental in devising a successful test strategy.
The SSX method sheds light on the true value of your testing efforts. This way, if you decide to move forward post-evaluation, you're equipped with a comprehensive understanding of what you will be facing along the way. Automation should amplify Salesforce's efficiency, not decrease it. Ensure that it enhances performance and cost-efficiency; if not, it might be worth re-evaluating.