---
schema_version: "1"
id: db35b3d520756dfcfa2f3a6daa57b8cbd925b04f90a996703bbec4f06d102841
title: Run the Same Tests in Sandbox and Production Deployments
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-migration-guide/guides/daas/forcemigrationtool-deploy-run-local-tests.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-migration-guide/guide/forcemigrationtool-deploy-run-local-tests.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 1c7b458d22e08a1540fe4a3827de20c0cce73859dc82b06fb074c9cdba7381a4
products:
  - Ant Migration Tool Guide
  - Platform Developer Content
---

# Run the Same Tests in Sandbox and Production Deployments

Starting in API version 34.0, you can choose which tests to run in your development environment, such as only local tests, to match the tests run in production. In earlier versions, if you enabled tests in your sandbox deployment, you couldn’t exclude managed package tests.

**note:** The Ant Migration Tool is retired with Spring ’24. The tool continues to function as-is for future API versions but isn’t updated with new functionality and isn’t supported. If Salesforce adds a new feature that is incompatible with Ant, the Ant Migration Tool won't be updated to support it. To manage metadata changes, switch to Salesforce CLI for a modern, supported developer experience.

By default, no tests are run in a deployment to a non-production organization, such as a sandbox or a Developer Edition organization. To specify tests to run in your development environment, set a [`testLevel` deployment option](https://developer.salesforce.com/docs/platform/salesforce-migration-guide/guide/forcemigrationtool-deploy.md). For example, to run local tests in a deployment and to exclude managed package tests, add the `testLevel="RunLocalTests"` parameter to the deploy target as shown in this example.

```xml
<target name="deployCode">
    <sf:deploy username="${sf.username}" password="${sf.password}" 
           sessionId="${sf.sessionId}" serverurl="${sf.serverurl}"
           deployroot="codepkg" testLevel="RunLocalTests">
    </sf:deploy>
</target>
```

**note:** The `RunLocalTests` test level is enforced regardless of the contents of the deployment package. In contrast, tests are executed by default in production only if your deployment package contains Apex classes or triggers. You can use `RunLocalTests` for sandbox and production deployments.

