Is the Eclipse "Force.com IDE" plugin able to deploy code with a "Run Specified Tests" validation option yet?

Or is using "Change Sets" my only user-friendly option if I want that level of control over my code deployment's validation?

(I really hate repeatedly refreshing that "Change Set Unavailable" page, but so long as I can't choose which tests to run, it still beats deploying through Eclipse at the moment...)

  • Workbench also allows you to pick the Run Specified Tests option – Dave Humm Sep 28 '16 at 19:09
  • The Force.com Migration Tool also allows you to Run Specific Tests and in my opinion far superior to Change Sets and Force.com IDE. – dBeltowski Sep 28 '16 at 19:26
  • 1
    There are also third party tools, like the one my company develops, that will give you this functionality. We have a thirty day trial so you can use it for this deployment and then not use it again if you don't like it : ) gearset.com – Kevin Boyle Sep 28 '16 at 19:31

Workbench also allows you to pick the 'Run Specified Tests' option and this could be used with a package created with other tools as long as you have a zip file with the directories and a package.xml file in the root level. Not sure it counts as the most user friendly deployment tool though.

It can also be used to extract the metadata for deployment though this requires creating a package.xml file to select the objects and other components you require.

enter image description here

|improve this answer|||||
  • Re: user-friendliness: I agree, I can probably click around Change Sets as fast as I can deal with package-making and such with respect to my own hands-on time (not sure which wins for start-to-finish time, but I doubt they're too far apart). :-) Thanks, though! – k.. Sep 28 '16 at 19:31

I ended up writing a 130-line Python script to:

  • Loop through some details I've hard-coded about items I'd like to deploy
  • Look for them on my hard drive (where Eclipse stores copies of files)
  • Zip up copies of them in an "uploadme.zip" file with a "package.xml" included
  • Generate a string representing the base64 encoding of "uploadme.zip"
  • Using 3 strings of XML representing minimalist SOAP envelopes the Metadata API, 1) log into my target Salesforce, 2) push the string representing "uploadme.zip" to a "deploy" API call specifying which tests to run, and 3) check how things went with a "checkDeployStatus" API call, printing the results to standard output.

Including firing up an IDE, typing in the things I want to deploy, & typing in my username/password, & tearing down (backspacing over my username & password when done and saving the script again), I'd say it saves about 10 minutes of my time over deploying via Eclipse with "Run All Tests" and about 2-8 minutes of my time over deploying with Change Sets & the Salesforce web user interface.

The efficiency really increases if I'm debugging a failing deploy and can leave the list of "things to deploy" alone between runs.

|improve this answer|||||

You can launch specified test from Tooling API.

You first need a connected App.

Second, The login service

curl https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=" -d "client_secret=" -d "username=edu.trujillo@xxxxxx.com" -d "password=xxxxxx"

And at the end, launch the test

curl -d '{"tests":[{"classId":"ID-CLASE_DE_TEST","testMethods": [ "NOMBRE-METODO_DE_TEST" ]}]}' -X POST https://xxxxxxx-dev-ed.my.salesforce.com/services/data/v40.0/tooling/runTestsSynchronous/ -H "Accept: application/json" -H "Content-Type: application/json;charset=UTF-8" -H 'Authorization: Bearer asd!123.456.789.000.123'

|improve this answer|||||
  • But I'm trying to deploy code w/ a "run specified tests." – k.. Oct 17 '17 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.