So, what is Default here mean?
If you deploy to production environment, all local tests are executed if your change set contains Apex classes or triggers. If your package doesn’t contain Apex components, no tests are run.
For deployment to development environments, such as sandbox, Developer Edition, or trial orgs, no tests are run by default.
What is the other options?
All tests in your org are run, except the ones that originate from installed managed packages. This test level is the default for production deployments that include Apex classes or triggers.
All tests in your org are run, including tests of managed packages.
Only the tests that you specify are run. Choose the test classes that provide sufficient coverage for the classes and triggers being deployed. Provide the names of test classes in a comma-separated list.
Code coverage requirements differ from the default coverage requirements when using this level in production. The executed tests must cover the deployed class or trigger with a minimum of 75% code coverage. This coverage is computed for each class or trigger individually and is different from the overall coverage percentage.
Developer ideally do not have access to Production org. When deploy components with apex class or trigger, by default deployment from a sandbox to other sandbox will not execute any tests. Only when it reach deployment to Production, by default it will execute all local test and you can't skip it.
When you have major deployment, it is recommended to select test level Run local tests when you deploy within sandboxes, this will lets you catch and fix issues before the customization are rolled out to production on a targeted deployment date.
Below sample of change set deployment contains apex class and trigger, then we validate in another sandbox.
this screenshot taken when deploy to sandbox and select Default test option
this is the same change set, but with option Run local test
- Trailhead - Efficient Deployments
- Trailhead - ALM Efficient Deployments
- Winter ’16 Release Notes - Choose Test Options for Change Sets
- Summer ’15 Release Notes - Choose Which Tests to Run in a Deployment
- Running a Subset of Tests in a Deployment