Most of us in the Salesforce ecosystem are familiar with Code Generation Copilots from Salesforce and Github. But you might not realize just how big of an impact AI in Salesforce Testing can have. This post will focus on how AI can help improve all aspects of your testing practices while making your entire team more productive.
If you are a developer, when you hear the word “testing,” you probably think Unit Tests. If you’re a test engineer or Business Analyst (BA), you probably think of Functional Tests.
The good news? AI can help with both.
Let’s start with Functional Tests. AI can write a test based on the description of the feature, long before the code is even written. Seriously. In fact, this is a Salesforce testing best practice. This “Shift Left” approach enables you to provide the developer with both a description of the requirements and a functional test that is ready to run once the code is complete. Efficient, right?
The test generated from the requirements is called an Intent Based Test. It relies on the requirements being complete, unambiguous and well-written. The more details you provide, the better the test. But how do you ensure that the User Story is good enough?
Use AI. Just like Developers use Static Code Analysis tools to Lint Code, you can use AI in Salesforce testing to enrich and clarify the User Story.
Developers, don’t just ask AI to generate the class –– ask it to generate the unit test as well. This method streamlines automated Salesforce QA, ensuring you’re testing right after the class is complete. This is why providing the Intent Based Unit Test is so important. The developer can execute the test on the completed feature to determine if it is done. Then, ask the AI to generate the unit tests once the initial tests pass.
Another best practice is to review the tests generated by AI to ensure they are reasonable. This applies to both Functional Test Automation and Unit Test Automation. With Functional tests, there’s another practice that helps in multiple ways: ask the AI to generate the Manual Test Steps required for verification before you generate the script. This not only ensures the test inputs and clicks are reasonable, but also gives you documentation for other testers to use during User Acceptance Testing (UAT).
While intent based testing is valuable, it mostly covers positive cases., It doesn’t push the boundaries of a feature or explore edge cases. That’s where AI-powered testing can step in to help.
First, the script must be prepared to work with multiple data inputs. The AI can do that on demand, substituting the hard-coded values for variables. Next a test engineer can guide the AI to create data sets for boundary cases as well as negative test cases. We say “guide”, because some knowledge of the boundaries is still needed, although the progress of AI has been relentless. In the near future, you may just need to ask for boundary tests.
There is a type of testing called Exploratory Testing, where a Subject Matter Expert (SME) conducts a testing session and explores different ways the application can be used. Tools like Copado Explorer allow these sessions to be recorded. AI can then take those recorded sessions, slice and dice them into multiple tests, and prepare them for automation. This greatly enhances Salesforce automated testing for exploratory and UAT sessions, where multiple SMEs can explore the new features. AI can then transform these sessions into automated tests, which makes UAT much more efficient.
Speaking of UAT, AI can generate the documentation you need to accompany each feature tested. This documentation can include screenshots, videos, summaries of the feature, and the manual test steps. All of this can be invaluable during UAT, helping to clearly communicate the goal and results of each manual test. See our Complete Guide to UAT on Salesforce for an in-depth look at best practices for UAT.
Test Data Creation deserves a little more inspection. Using production data in test environments can risk exposing Personally Identifiable Information (PII) and company confidential information, which is why understanding data storage regulations is crucial for maintaining compliance. It is better to use synthetic data which is representative of production data. AI can help here by creating data that feels like real data.
Try asking your favorite GenAI tool to generate a list of names, addresses and phone numbers, ensuring the phone numbers are appropriate for the addresses. Now do it again, but restrict the location of the data to, say, Paris, and ask that the names match the location. Don’t forget to ask that the output be formatted in a Comma Separated Value (CSV) format so you can import it directly into your testing tool. This will give you a taste of how easy it is to generate data with AI.
So you’ve curated a substantial amount of automated tests and you have just completed a full test run on the environment prior to your UAT event. Now, you need to review the test logs to determine which tests failed and which of those were due to broken tests and not bugs. This can be a painful experience, but AI can help here as well.
AI can:
All of that while you take a much-needed coffee break.
Copado has released a Test Run Analysis tool that accomplishes all of the steps listed above, streamlining the time it takes to investigate and disposition the results of your automated tests.
As you can see from this brief overview, AI can make a big impact on your testing processes in the Plan, Build and Test phases of DevOps. It starts by improving the requirements that feed into every other aspect of the test and then generating all of the components of the test plan for you to review. This helps the developers, testers and even the BA.
AI can help with the Release and Operate phases as well, but that is a topic for another post.
Level up your Salesforce DevOps skills with our resource library.