Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Apex Test Studio — AI Test Generator for SalesforceNew to Visual Studio Code? Get it now.
Apex Test Studio — AI Test Generator for Salesforce

Apex Test Studio — AI Test Generator for Salesforce

Rajesh Kumar

|
1 install
| (0) | Free
Autonomous AI-powered Apex unit test class generator for Salesforce. Synthesizes 85%+ coverage tests with live org metadata, mock generation, and governor limit bulkification.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

⚡ Apex Test Studio

The Autonomous AI Unit Test Generator for Salesforce

Visual Studio Marketplace Version Salesforce Ready Target Coverage Security License


Apex Test Studio is an autonomous, context-aware AI testing engine for Salesforce developers, architects, and engineering teams. Right-click any Apex class or trigger to synthesize production-ready @isTest unit test suites targeting 85%+ code coverage that compile and pass on the first run.

Key Features • How It Works • Security & Privacy • Quick Start • Configuration


⚡ Why Developers & Teams Choose Apex Test Studio

In Salesforce development, no code can be deployed to Production without a minimum of 75% test coverage. Writing and maintaining unit test classes manually consumes 30% to 50% of developer sprint velocity.

Generic AI coding assistants frequently generate Apex tests that fail to compile or crash in Salesforce environments:

Problem in Generic AI Root Cause in Salesforce What Apex Test Studio Delivers
REQUIRED_FIELD_MISSING AI is unaware of custom org-specific required fields 🔍 Org-Aware Data: Automatically injects required custom fields & types for your specific org
INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST AI invents non-existent picklist values 📋 Valid Picklists: Matches active picklist values so records insert cleanly
FIELD_CUSTOM_VALIDATION_EXCEPTION AI violates custom business validation rules ⚡ Rule-Compliant Records: Generates test data that satisfies your org's active validation rules
System.CalloutException: You have uncommitted work... AI fails to mock HTTP web service calls 🌐 Automatic Mocks: Detects web service calls and creates companion HttpCalloutMock classes
MIXED_DML_OPERATION DML on Setup and Non-Setup objects in same transaction 🛡️ Transaction Isolation: Automatically wraps User/PermissionSet DML in System.runAs()
Governor Limits on Batch/Trigger Test only runs 1 record; fails in production bulk runs 🚀 200-Record Bulk Suites: Generates governor-limit-safe tests for triggers and batch Apex

⚡ How It Works

Generate comprehensive, passing Apex unit test suites in 3 simple steps:

  1. Open Any Apex Class or Trigger — Open any .cls or .trigger file in your Salesforce project.
  2. Right-Click $\rightarrow$ Generate — Choose 🧪 Generate Apex Test Class (or press Ctrl+Shift+T).
  3. Instant Production Test Suite — A companion [ClassName]Test.cls opens beside your code in split view, complete with @TestSetup, positive/negative test cases, mock classes, and 85%+ coverage targeting.

🌟 Key Capabilities

1. 🔍 Full Branch & Edge Case Coverage

  • Covers positive happy paths, negative error branches, and boundary conditions.
  • Adheres to Salesforce testing best practices: @TestSetup factories, Test.startTest() / Test.stopTest() isolation, and rigorous assertions (Assert.isTrue(), System.assertEquals()).

2. ☁️ Org-Aware Schema Intelligence

  • Automatically detects required custom fields, relationships, and restricted picklists.
  • Ensures synthetic test records conform to your org's active business validation rules without manual data staging.

3. 🛡️ 10 Supported Salesforce Patterns

Apex Test Studio comes with built-in intelligence for 10 common Salesforce development patterns:

Pattern Supported Behavior
Triggers & Handlers Bulk DML operations (insert, update, delete, undelete) and addError() validation
HTTP Web Callouts Auto-generated companion HttpCalloutMock handling 200, 400, and 500 status codes
Batch Apex Complete Database.executeBatch() lifecycle testing within transaction boundaries
Queueable Apex Asynchronous job execution validation with System.enqueueJob()
Schedulable Apex CRON expression validation and scheduled execution verification
Future Methods Queue flushing and asynchronous method assertions
Setup vs. Non-Setup Prevents MIXED_DML_OPERATION exceptions by isolating transactions with System.runAs()
Bulk Governor Limits 200+ record bulk testing suites to ensure governor limit compliance
Lightning / LWC Controllers Tests @AuraEnabled controller endpoints with success and error scenarios
Security & CRUD/FLS Multi-profile context testing using System.runAs()

🔒 Security & Data Privacy

Apex Test Studio is engineered with security and data privacy as core principles:

  • 🛡️ Zero Data Retention: Your Apex source code is transmitted directly via TLS 1.3 HTTPS to the AI provider endpoint of your choice (Google Gemini, Anthropic Claude, or OpenAI). Code is never stored, retained, or used for model training.
  • 🚫 No Intermediate Proxy Servers: All processing occurs locally within your VS Code instance. There are no middleman servers, external telemetry aggregators, or third-party cloud brokers.
  • 🔑 Encrypted Secret Storage: AI API keys are stored securely using VS Code's native OS keychain encryption (SecretStorage), never exposed in plaintext configuration files.
  • ☁️ Zero Org Credential Transmission: Salesforce credentials stay inside your local Salesforce CLI (sf). Apex Test Studio never sends org tokens, usernames, or instance URLs to external LLM APIs.

🚀 Quick Start

1. Prerequisites

  • VS Code: Version 1.85.0 or higher
  • Salesforce CLI (sf): Installed and authenticated to your target sandbox/scratch org (sf org login web)
  • AI API Key: Google Gemini (recommended), Anthropic Claude, or OpenAI

2. Configure Your AI Key

  1. Open VS Code Settings (Ctrl+, on Windows/Linux or Cmd+, on macOS).
  2. Search for Apex Test Generator.
  3. Select your preferred provider (default: gemini) and enter your API key.

3. Generate Your First Test Class

  1. Open any Apex class (.cls) or trigger (.trigger) in your Salesforce project.
  2. Press Ctrl+Shift+T (macOS: Cmd+Shift+T), or right-click the editor and choose:
    • 🧪 Generate Apex Test Class — Creates [ClassName]Test.cls and opens it in side-by-side view.
    • 🚀 Generate, Deploy & Run Test Class — Generates the test, deploys to your connected sandbox, executes the test suite, and displays live pass/fail results with code coverage %.

⌨️ Command Palette Integration

Command Title Default Shortcut
apexTestGen.generateTestClass 🧪 Generate Apex Test Class Ctrl+Shift+T / Cmd+Shift+T
apexTestGen.generateAndDeploy 🚀 Generate, Deploy & Run Test Class Context Menu
apexTestGen.refreshMetadata 🔄 Refresh Org Metadata Command Palette
apexTestGen.showResults 📊 Show Test Results Command Palette

⚙️ Configuration Matrix

Customize Apex Test Studio behavior in your settings.json or VS Code Settings UI:

Setting Key Type Default Description
apexTestGen.aiProvider string "gemini" Active AI provider ("gemini", "claude", "openai").
apexTestGen.aiApiKey string "" API key for the selected AI provider.
apexTestGen.aiModel string "" Specific model override (e.g., gemini-3.5-flash-lite, claude-sonnet-4-20250514, gpt-4o).
apexTestGen.targetCoverage number 85 Target code coverage percentage ($\ge 75%$ required by Salesforce).
apexTestGen.defaultOrgAlias string "" Target SFDX org alias for schema reflection (blank = default org).
apexTestGen.includeSecurityTests boolean true Generate System.runAs() profile access tests.
apexTestGen.includeBulkTests boolean true Generate 200+ record bulk tests for governor limits.
apexTestGen.autoDeployToSandbox boolean false Automatically deploy and execute tests upon generation.
apexTestGen.maxRetries number 2 Number of self-healing retries if validation detects syntax or DML issues.

📊 Benchmark & Quality Standard

Metric Industry Standard (Generic AI) Apex Test Studio
First-Run Compilability Rate 35% – 45% 92%+
Code Coverage Target 60% – 70% 85% – 95%
Bulk Testing Included ❌ (Single-record only) ✅ (200-record bulkified)
Mock Generation ❌ (Manual mocks required) ✅ (HttpCalloutMock auto-generated)
Required Custom Fields Injected ❌ (Fails with REQUIRED_FIELD_MISSING) ✅ (Discovered via SFDX Describe)
Validation Rules Handled ❌ (Triggers validation errors) ✅ (Reflected via Tooling API)

📄 License & Attribution

Distributed under the MIT License. See LICENSE for details.

Developed for the global Salesforce developer community.
For support, bug reports, and feature requests, visit the Issue Tracker.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft