Salesforce Run Specified Tests Feature

There is one new very cool feature called “run specified tests”.

Whenever you run your deployment or validation you may now select unit tests you want to run! This can save deployment or validation time tremendously!

This feature has been initially introduced in the Summer’15 Release ( you may refer to related Release notes here or to Salesforce tutorial here ). There was a bug in this feature claimed to be fixed in Winter’16 Release, and that is cool, I guess.

To use this feature in your ANT Migration Tool you will require the latest Force.com Migration Tool jar, which you may download directly from your production org or from any of your sandboxes here.

Also you need to add a new target inside your build.xml file specifying which tests you would like to run:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<target name="1*. Deploy to Production running a few tests?">
<sf:deploy username="${sf.production.username}"
password="${sf.production.password}${sf.production.securityToken}"
serverurl="${sf.production.serverurl}"
deployRoot="../${sf.deploy.dir}/${sf.sandbox.dir}"
rollbackOnError="true"
maxPoll="${sf.maxPoll}"
testLevel="RunSpecifiedTests"
pollWaitMillis="${sf.pollWaitMillis}">
<runTest>TestClass1</runTest>
<runTest>TestClass1</runTest>
<runTest>TestClass1</runTest>
</sf:deploy>
</target>

Click share or like if you also enjoy this new feature!

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *