10

I am using ant tool to deploy code to Sandbox which has Managed package test methods failures. Build error shows the validation rule message. Build is executed by Jenkins schedule job, so turning on and off the validation rule is not possible eachtime. Build.xml files has with "runalltests=true".

Following things I came to understand from the Force.com Migration Tool guide:

  1. While deploying the code to Production all tests except of Managed Package will be executed regardless of the "runalltests" value, is this not the case with Sandbox?
  2. In some of the stackexchange question I saw <runtest namespace="default" /> But document don't have anything related to this
  • If there are failures in managed package code that should not stop you from deployment ?Whats the error message retrieved ? – Mohith Shrivastava Nov 1 '13 at 18:41
  • Error shows the validation rule exception which is thrown by the Managed Package test method. – Prasanna Nov 1 '13 at 18:48
  • can you just try doing a validate with changeset or eclipse .Usually managed package test failures don't bother during deployment – Mohith Shrivastava Nov 1 '13 at 19:12
  • Is it one of your validation rules? If so, you can temporarily deactivate it. – Mike Chale Nov 1 '13 at 20:50
  • Build is executed from Jenkins schedule job, so turning on n off of validation rule is not possible. – Prasanna Nov 3 '13 at 9:53
6

While deploying the code to Production all tests except of Managed Package will be executed regardless of the "runalltests" value, is this not the case with Sandbox?

That is not correct. All unmanaged tests will run when deploying to a production org, regardless of the runalltests flag. The managed package tests only run if runalltests is set to true.

The SalesForce help explains it as:

In Production - if set to false, then managed package tests will not run but every other test will run. In Sandbox - if set to false, no tests will run.

So to summerize:

  • Setting runalltests to true will run all tests (managed/unmanaged) in all orgs
  • Setting runalltests to false will stop all tests (managed/unmanaged) from running in all orgs except for production where the unmanaged tests will always run
  • 2
    +1, as an employee at a big ISV I can confirm this is the case. – ca_peterson Jan 17 '14 at 0:53
1

I can confirm this. We recently re-engineered our CI process with new sandboxes, which inherited managed packages from the Production Org. When we re-configed our Jenkins jobs with the runalltests=true flag for our sandboxes (Integration, QA, UAT), all the builds failed because there are errors with the managed package tests (some due to validation, some due to other issues). These same errors occur if you run a build in Production with runalltests=true. However, removing that attribute or setting runalltests=false only runs the tests for code that is NOT in an installed packaged. It would be nice if Salesforce added an option for running only non-managed code using Ant. The lack of this feature renders our CI process useless.

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.