Blue Canvas
Plans
EN|ESContact usLoginGet Started
Developer Tips

Use ApexUnit and Selenium to Speed Up Salesforce Development

Unit and functional tests are a key part of any continuous integration pipeline. Here are some tools that make testing easy for Salesforce.

Randalyn Hill-CofferBy Randalyn Hill-Coffer·Reviewed by the Blue Canvas team·December 4, 2024·Updated May 26, 2023·3 min read
In this article

    There are few topics in the Salesforce developer community that draw more eyebrow raises than unit testing. By now, most Salesforce developers acknowledge and embrace the benefit of unit testing.


    Most agree that unit tests actually save you time in the long run. As Kevin Poorman notes in the above video, the average lifespan of a software project is 12 years. The average lifespan of a developer at a corporation is about 2 years and 3 months. So most of the time spent on a software project goes to maintenance rather than actual development of new software. As unglamorous as it sometimes seems, unit testing is very helpful for the maintenance of a code base. Unit tests serve as a type of documentation that can help developers that come to a project later on understand what the code is trying to do.

    Unit tests are also crucial for Continuous Integration. Running automated tests allows you to deploy your code with confidence much faster than you could if you were manually testing everything.

    UNIT TESTING CHALLENGES WITH FORCE.COM

    Still, despite the nearly universally acknowledged and unassailable wisdom behind writing unit tests, Force.com doesn’t make it very easy to do actually do unit testing. Though there is a requirement that you have 75% test coverage on deployed Apex code, unit testing on Force.com presents a number of unique challenges that developers on other platforms don’t face.

    First, Salesforce doesn’t let you mock your classes or objects the way you might with another environment. It’s difficult to do stubs. And as a cloud platform, there is no way to run tests locally.

    The toughest thing about Salesforce development is how painfully slow unit tests are on the platform. Teams can wait up to 24 hours or more just to run through an entire suite of tests. It’s basically impossible to do Continuous Delivery if this is the case.

    There are also some problems specific to Apex as well. Despite the code coverage requirement from Salesforce, Force.com doesn’t make it all that easy to visualize coverage of your classes and objects. Grouping and filtering is difficult as well. How can you put tests together and create suites? How do you set your unit tests up to work with a Continuous Integration server like Jenkins or Bamboo? And how do you use reporting on your unit tests to see what is happening over time?

    APEXUNIT IMPROVES UNIT TESTING FOR SALESFORCE DEVELOPERS


    ApexUnit is an open source unit testing framework created by Salesforce to help address some of the issues (though unfortunately not all) mentioned above. ApexUnit is designed to make managing unit tests easier for Apex just as other popular unit testing frameworks such as TestNG and JUnit do for Java and NUnit does for C#.

    ApexUnit is a command line interface (CLI) implemented in Java. It “seamlessly” integrates with CI servers like Jenkins and TeamCity in that you can use the CLI to make build steps. ApexUnit allows you to schedule and run unit tests asynchronously. You can also use it to filter and group tests into suites.

    ApexUnit helps with code coverage requirements by providing metrics and test reports in JUnit XML including a feature that lets you drill down into failures for debugging. The code coverage tool provides line by line information about code coverage including helpful red and green highlighting to help see which areas require more coverage. All of this ties nicely into CI tools like Jenkins because of the standard formats used (e.g. JUnit xml reports) and the CLI. Live test logging allows you to have a better picture of what’s happening with your unit tests in real time.

    To learn more about ApexUnit check out the GitHub page.

    GOING BEYOND UNIT TESTS WITH SELENIUM

    Apex Unit tests are great, but what about full on integration tests to ensure that your code is working end to end? Selenium Webdriver is a useful tool for doing this. Selenium tests are great because they allow you to test your user experience end to end in multiple browsers. Salesforce MVP Jitendra Zaa has a great series of posts on integrating Salesforce with Selenium here that are a great starting point for any Salesforce developer looking to do more than just unit test.

    Happy testing!


    ‍

    Comments

    Leave a comment

    Newsletter
    Salesforce DevOps tips in your inbox

    New posts, releases and practical guides. No spam, unsubscribe anytime.

    TABLE OF CONTENTS
    • UNIT TESTING CHALLENGES WITH FORCE.COM
    • APEXUNIT IMPROVES UNIT TESTING FOR SALESFORCE DEVELOPERS
    • GOING BEYOND UNIT TESTS WITH SELENIUM
    You may like
    Trending on Blue Canvas
    Talk through your Salesforce setup

    Get a focused walkthrough or a tailored quote

    Book a consultationRequest a quote
    Customer stories
    Real teams, real results
    Sysco
    Sysco
    Left Jenkins behind and cut deployments from hours to minutes
    Twilio
    Twilio
    Saved 2–3 days each sprint while scaling the team quickly
    Catalyst Consulting
    Catalyst Consulting
    The City of Chicago saves hours every day with code reviews and structured rollouts
    You might also like our other posts...
    Read more
    Salesforce DevOps
    Kenji Sano | October 14, 2026
    7 Best Salesforce Version Control Tools in 2026: Compared

    A practical comparison of seven Salesforce version control options, with strengths, trade-offs, Git support, admin usability, and guidance for choosing the right fit.

    Read more
    Salesforce DevOps
    Kenji Sano | October 6, 2026
    The 8 Best Salesforce Deployment Tools in 2026

    Compare the top 8 tools side by side — and see which one fits your team.

    Read more
    Architecture and Resources
    Randalyn Hill-Coffer | October 5, 2026
    Top 19 Academic Operations Tools for Salesforce-Run Higher Ed Campuses in 2027

    Compare 19 academic operations and adjacent higher ed tools for Salesforce-run campuses in 2027. See what runs on Salesforce, what connects through your SIS, and where you may need an integration.

    Blue Canvas

    Salesforce DevOps for teams. Git-based version control, metadata backups, and continuous deployment.

    (786) 591-0702

    SOC 2 certifiedSalesforce PartnerSalesforce AppExchange

    Salesforce Deployment

    • Deployment Tools
    • For Salesforce Metadata
    • For CPQ Data

    Product

    • Features
    • Security
    • Customer stories
    • Pricing

    Resources

    • Docs
    • Blog
    • Academic Operations
    • Anthropic x Salesforce Poll
    • Partners
    • Integrations
    • Release Management

    Company

    • About us
    • Contact us
    • Careers
    • X (Twitter)
    • LinkedIn
    • GitHub
    Stay Updated
    Product Updates

    Get the latest features, releases, and technical deep-dives delivered straight to your inbox.

    Secure & Private

    ·

    No spam, unsubscribe anytime

    © 2026 Blue Canvas. All rights reserved.

    Privacy PolicyTerms of usage