Request A Demo
Back to All Blog Articles

FlexDeploy Loves Salesforce: Unit Test and Test Automation for Salesforce

FlexDeploy is an Enterprise DevOps platform with fully integrated support for Salesforce apps, metadata customizations, integrations, and more. This is the last article in a blog series that will help you understand what makes FlexDeploy a perfect choice to implement DevOps, CI/CD, and release automation with Salesforce.

Here is a summary of the FlexDeploy Loves Salesforce series.

FlexDeploy’s extensive set of features for Salesforce and Test automation with test plugins:

  • Ensure that Salesforce changes work as expected.
  • Provide a suite of regression tests that can be rerun every time so you don’t break existing functionality.
  • Meet code coverage requirements as per your preset thresholds.
  • Ensure high-quality deployment to production and happy business users.

DevOps for Salesforce eBook

Unit Tests

The Apex testing framework enables you to write and execute tests for your Apex classes and triggers. Apex unit tests ensure high quality for your Apex code and let you meet the requirements for deploying Apex. You can configure your test levels at the package level and ensure that tests are executed during deployment.

Test Level options in the Package Details tab

Apex tests will be executed as part of the deploy or validate package and results will be captured. You can view the results in FlexDeploy and also automate deployment promotions based on test results, ensuring your package will get promoted to the next environment only if you have successful results. Users can be confident the required unit tests are executed and have visibility on what got executed.

Project Workflow Execution for FlexDeploy's support for Salesforce

Code Coverage

Define code coverage thresholds in FlexDeploy. For example, you can stipulate that at least 75% of Apex code must be covered, and all those tests must pass. From your Apex Test, the code coverage percentage will return as output. You can look at those results for manual approval or define a gate in your pipeline to act upon. FlexDeploy will notify the developer/team to work on the unit tests to increase the coverage.

Static Code Analysis

Along with Unit testing, most of our customers use static code analysis tools like PMD and SonarQube to increase the quality of the code. These tools help find Bugs, Security Vulnerabilities, and Code Smells. FlexDeploy has support for both of these tools, and you can automate the executions after pulling the code from your Org or before deploying. You can view the results in FlexDeploy and also take automated actions based on the results.

This analysis is normally done after pulling the Apex code from a Salesforce Org or Source Control (like Git). You could also configure your workflow to re-run the analysis before approving the deployment to each environment.

analyzeApexCode option in the Execution Steps tab

FlexDeploy will execute the analysis based on your custom rule file if you have one. Otherwise, it uses the default rules. You can view reports in FlexDeploy for manual approvals or you can configure to fail or auto promote the package based on the results.

The PMD Static Code Analysis Report in the Reports tab

Based on the priority, any issues get a separate report file to view and/or download.

Test Automation

FlexDeploy’s full-grown Test Automation framework can be utilized to configure what tests run in each environment. Test automation tools like Selenium, Tosca, HP UFT, and Automation Anywhere can be used to execute tests. Simply configure FlexDeploy to execute the tests and automate the code promotions based on the test results.

Test Automation for Salesforce Deployments in the Strategy tab

FlexDeploy has a robust pipeline and release automation system. With that, all the results from the same environment or any of the previous environments can be verified prior to promoting the changes.

FlexDeploy's Salesforce deployment pipeline

FlexDeploy provides many capabilities in Test and Code review to achieve high-quality Salesforce deployments. But you don’t need to have all of it on day one. You can mature the process as you go with simple configurations.

Related Resources

Mastering Source Control: Streamlining Functional Setup Data Sync with FlexDeploy and Git Integration in Oracle FSM

Effective source control management (SCM) is pivotal in ensuring the seamless tracking and management of functional setup data. In this ...

Oracle Integration Cloud – Migrate Integrations, Connections and Lookups

Oracle Integration Cloud (OIC) serves as a unified platform for seamlessly integrating cloud and on-premises applications. FlexDeploy, a robust DevOps ...

Unlocking Precision in Oracle SaaS FSM: Dive into FlexDeploy’s Filter Criteria for Effortless Setup Migration

While Oracle’s Functional Setup Manager (FSM) UI facilitates export/import operations for transferring setups across environments, the process demands manual initiation, ...

Join DevOps leaders across the globe who receive analysis, tips, and trends in their inbox