I have package.xml file which contains apex classes, test classess , triggers. So, I need to runalltest in the org only run test class which is contained in my manifest file and deploy to org is there any way to do that? How can we use ant script to build to runalltest in org?

1 Answer 1


No, there is no Metadata API deployment option for "run all tests being deployed". The test run levels available to you are documented (among other places) in the Metadata API documentation.

Your choices are:

  • NoTestRun (which is not applicable when deploying Apex to production).
  • RunSpecifiedTests, where you may list a specific group of tests (but you must list them explicitly; you cannot derive the list from package.xml).
  • RunLocalTests, which is both the default and the best option, runs all tests other than packages tests in your org.
  • RunAllTestsInOrg, which runs all tests including packaged tests.

It's not a good idea to run only the tests in your deployment, as your code changes may impact the behavior of other code in the target org. Running local tests is usually the right choice.

  • can we use ant script to do this?
    – Neetesshhr
    Feb 10, 2023 at 5:18
  • I imagine you can, if you're willing to write some Java. I'm not aware of any built-in feature that does this, but I'm not an Ant expert. That build chain is really obsolete at this point.
    – David Reed
    Feb 10, 2023 at 5:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .