function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gino BassoGino Basso 

Deploying Apex with ANT: runTest runs all tests

I'm deploying a series of Apex classes using the Migration Tool (i.e. ANT). However, when I specify an explicit test class I get all errors for classes that already exist (the target instance is a sandbox), and have no bearing on the Apex classes I'm deploying. In short, it seems to be running all tests.
The classes I'm deploying aren't packaged, and neither are the existing classes which produce the errors.
Here's is my ANT task:
    <target name="deployWebSvcPkg">
      <sf:deploy username="${dest.username}" password="${dest.password}" serverurl="${dest.serverurl}" deployRoot="webSvcPkg">

Any ideas as to why these other (existing) classes end up being tested run I run the above task?
Hi Gino,

I've seen this too, with the latest version of the IDE while running tests. This is my understanding (though its not based on any documentation). When you run WebSvcTest, this test touches other code (apex classes). The system then runs the corresponding tests, to get an accurate code coverage. I'm not sure what the logic is in choosing the corresponding tests...


I'm getting errors for not having (any %0) code coverage on a lot of triggers when I deploy using <runTest> example </runTest> and runAllTests=False.  Any idea why?


Seeing the exact same problem, even after upgrading to the last version of ant-salesforce.jar (27.0)

About every 6 months I say to myself "gee, it would be nice to be able to run tests from the command line". And every time I try it, something doesn't work.

I wonder if directly invoking the metadata API, rather than going via ANT, would give me want I want...


It works for everything except apex.  We're thinking apex components have to have 100% coverage to deploy via "fast deploy" aka using <runTest> .  Getting clarification from the product owner soon..... 


I am using ant from the command line to deploy to my DE org, so this insistence on coverage is useless / premature. My coverage will be verified when I try to upload my package, so I'm already "protected" - no need to throw it up here too.

Got it. That is annoying. Will let you know if I hear anything...
King KooKing Koo

I'm afraid not.


Even at 29.0 I'm still getting the same error.  


And I'm running the example it's given in its migration doc......


Good to know I'm not the only one encountering this.  So I guess I just won't run any test during migration.  Will do that afterwards.