3

I am using the ant migration tool. And this have never happened till today. The ant target to delete looks like

<target name="undeployCode">
  <sf:deploy
    username="${sfdc.username}"
    password="${sfdc.password}"
    serverurl="${sfdc.serverurl}"
    deployRoot="${basedir}/removecodepkg"
    pollWaitMillis="${sfdc.pollWaitMillis}"
    maxPoll="${sfdc.maxPoll}"/>
</target>

And inside the removecodepkg directory, i have an empty package.xml and a file called destructiveChanges.xml

package.xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>39.0</version>
</Package>

And the destructive xml

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>  
        <members>UtilityToHandleLeadTriggers</members>
        <members>TestClassLead</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>CustomLeadConversionPage</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>EventTrigger</members>
        <members>LeadTrigger</members>
        <members>OpportunityTrigger</members>
        <members>TaskTrigger</members>
        <name>ApexTrigger</name>
    </types>
    <version>39.0</version>
</Package>

Was there anything changed with Summer'18 release that triggers all of the test execution in prod, while running a destructive package in it?

3

Destroying elements in an org can certainly break existing code. Imagine if you remove a trigger, and there is code that depends on values set by that trigger. That's why test execution is trigger in production.

For deployments to non-production orgs, you can specify a testLevel of NoTestRun. I don't normally recommend this, but it may fit your development cadence.

You can find info on the above here and here

  • Are u sure on what you are stating as an answer? First, sf doesn’t allow u to delete anything that’s being referred elsewhere. Second, the test were not triggering earlier in prod too while executing destructive package. – OK999 Jun 20 '18 at 19:31
  • I am 100% positive. Triggers are not referenced directly by a class, for example, but that class might be expecting a trigger to update a value. While it is true that SF does not let you remove things that are directly referenced, there are multiple ways that code is affected by other code that it does not directly reference. – Sebastian Kessel Jun 20 '18 at 19:34
  • In short, it is bad practice to remove code/metadata and not run tests and, in production, SFDC prevents you from following that bad practice. – Sebastian Kessel Jun 20 '18 at 19:34

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.