I needed to validate that the deployment of some components would succeed. The deployment would be between two sandboxes of the same production org.
The components were two class/test class pairs that were already in the destination sandbox (i.e. only changes to the existing code were intended for deployment):
SetRequestOpportunityFields
SetRequestOpportunityFieldsTest
RemoteTrxPaymentCtrl
RemoteTrxPaymentCtrlTest
I wanted to use SFDX to validate. The first step I completed was to convert the items above from source to metadata format (although now it looks like there's no difference for classes).
I ran this command:
sfdx force:source:convert -d metadata/10282020INTDEPLOY \
-p force-app/main/default/classes/SetPaymentOpportunityFields.cls,\
force-app/main/default/classes/SetRequestOpportunityFieldsTest.cls,\
force-app/main/default/classes/RemoteTrxPaymentCtrl.cls,\
force-app/main/default/classes/RemoteTrxPaymentCtrlTest.cls
That created these files:
Then I finally ran this command to perform the validation:
sfdx force:mdapi:deploy -u hsint -c \
-d metadata/10282020INTDEPLOY \
-l RunSpecifiedTests \
-r SetRequestOpportunityFieldsTest,RemoteTrxPaymentCtrlTest
But the validation Failed:
So I wanted to compare that SFDX validation attempt with a change-set validation.
I created a change set with the same components:
Then I ran validation on the change set with the same tests specified as my SFDX attempt (and which are the same tests in the deployment package):
And that validation succeeded:
So why the difference?