r/SalesforceDeveloper • u/rky0010 • 2d ago
Discussion Introducing an Autonomous AI-Powered Unit Test Generator for Salesforce – Apex Test Studio
Writing Apex unit tests can be challenging, especially when dealing with complex business logic, multiple execution paths, exception handling, and Salesforce's 75% minimum code coverage requirement.
To simplify this process, I built Apex Test Studio, an AI-powered VS Code extension designed to automate Salesforce Apex unit test generation. It's now available on the VS Code Marketplace!
Here's what it brings to the table:
Targets 85%–90%+ Code Coverage
Identifies uncovered execution branches and generates additional test scenarios to help improve overall code coverage.
Intelligent & Functional Test Scenarios
Generates positive, negative, edge-case, and exception-handling scenarios, along with 200-record bulk testing and meaningful System.assert statements.
Existing Test Class Enhancement – No Overwriting!
Preserves existing @testSetup methods, mocks, and passing tests while intelligently adding only the missing @isTest methods.
AST-Based Code Analysis & Auto-Repair
Analyzes methods, variables, conditions, and execution paths. Identifies and fixes common code-generation issues and automatically generates HttpCalloutMock implementations for callouts.
Privacy & Developer Flexibility
Designed with single-file isolation, no repository-wide scanning, and support for your own Gemini, Claude, or OpenAI API key.
The Vision Behind Apex Test Studio
Move beyond generic AI-generated code and make Salesforce test automation more intelligent, structured, and reliable.
Building this project has been an exciting journey of bringing together TypeScript, LLMs, AST Analysis, SFDX Schema Reflection, and Salesforce development.
The extension is now available on the VS Code Marketplace!
Watch the demo below!
I'd love to hear your thoughts, feedback, and suggestions.
What do you think is the biggest challenge developers face when writing Apex test classes?
#Salesforce #ArtificialIntelligence #LLM #Apex #VSCode #TypeScript #GenerativeAI #SoftwareTesting #SalesforceDeveloper #TrailblazerCommunity
1
u/toadgeek 2d ago
Sorry for being blunt, but how does this differ from having a dedicated AI skill for writing and running Apex unit tests reliably?
I'm asking from a simplicity standpoint, and by no means trying to diminish your work.