New Release: Smarter Apex Test Generation, CI/CD Integration, and Flaky-Test Detection

Test Class Generator adds org-aware Apex generation, CI/CD integration, flaky-test detection, and improved mock/data strategies to accelerate Salesforce testing.

## What’s new in this release

Test Class Generator's latest update focuses on three customer-requested areas: org-aware Apex generation, first-class CI/CD integrations, and automated flaky-test detection. These features are designed to reduce time spent writing tests, improve stability across environments, and make test automation safer for production pipelines.

## Key features and practical benefits

### Org-aware Apex generation

Our generator now inspects target org metadata (custom fields, managed packages, record types, and feature flags) before producing tests. That means generated test classes:

- Use correct API names and available picklist values

- Create records that respect required fields and triggers

- Avoid references to non-existent package namespaces

Practical tip: When switching between sandboxes and production, run the lightweight org sync. It takes seconds and prevents common deployment-time failures.

### CI/CD integrations

We added native connectors for common pipelines (GitHub Actions, GitLab CI, Azure DevOps) plus a CLI mode for headless runs. New capabilities include:

- Pre-merge test generation and validation step

- Auto-commit of hardened test stubs to a feature branch (configurable)

- Failure annotations with produced test code snippets in PRs

Practical tip: Add Test Class Generator as a pre-merge job to generate and validate tests against the target branch's metadata. This catches environment-specific issues before a full deployment.

### Flaky-test detection and targeted repairs

Flaky tests are costly. The new analyzer runs historical test runs (from your CI) and flags tests with intermittent failures. For flagged tests we provide:

- Root-cause hints (shared state, time-dependency, async behavior)

- Suggested hardening steps (use of Test.startTest/Test.stopTest, proper mocking, isolation of static state)

- Optional auto-refactor to add reliable mock patterns or test isolation scaffolding

Practical tip: Configure a 14–30 day window for flakiness analysis to prioritize tests affecting recent changes.

## Other improvements

- Improved mock and fake data generation: generate realistic relational test data and reusable factory patterns.

- Performance: generation time reduced by up to 40% for large orgs through incremental metadata caching.

- Security: read-only metadata access and configurable data redaction for sensitive org attributes.

## How to adopt this release

1. Upgrade your Test Class Generator instance or enable the feature flag in your dashboard. 2. Run an initial org sync to populate metadata. 3. Add the CI job template or enable CLI mode in your pipeline. 4. Start by targeting critical classes and leverage flaky-test reports to triage engineering effort.

Conclusion

This release is focused on making generated Apex tests reliable across orgs and pipelines while cutting manual overhead. Try the new org sync + CI template in your next sprint, and let the flaky-test analysis show where to prioritize hardening. Visit your Test Class Generator dashboard to enable the update or contact support for a guided migration.