One of the biggest mistakes when it comes to testing, is assuming that if you cover 100% lines of code you are adequately covered. Just because you have code coverage it does not mean you are covered.
A Realistic Approach to Software Testing on the Salesforce Platform
Chances are that if you’ve developed custom code on your org, you have at least 75% code coverage on the Apex portion of that. Because Salesforce requires that to deploy. But that alone is not a testing strategy for your Org. How much testing should you have? What type of testing should you do? What should you test? These questions are often overlooked when it comes to developing software on the Salesforce Platform.
SFDX Quick Tip: Login to a Sandbox Org with the SFDX CLI
By default the SFDX CLI command sfdx force:auth:web:login will not work if you’re trying to login to a sandbox org. This will open up a window to login.salesforce.com . And as we know to login to a sandbox you need to go to test.salesforce.com.
The Solution
Use the -r or --instanceurl flag with your command. This lets you specify the path of the login page you want to authorize from.
So you have sfdx force:auth:web:login -r https://test.salesforce.com
Summer ’18 for Manufacturing – Sales, Support, Marketing and IT
SFDX Quick Tip: Pulling source from a Sandbox into an SFDX project.
TL;DR: The easiest way is to create an unmanaged package.
- Create an unmanaged package with everything you want to move over.
- Convert the unmanaged package with the SFDX CLI
- Push to a Scratch Org
Create the unmanaged package
Setup > Quick Find > "Package" > Create > Packages
Next Select the files you want:
Retrieve the package with the CLI:
sfdx force:mdapi:retrieve -s -r {{pathToCreatePackageFile}} -u {{sandboxUsername}} -p {{packageName}}
Example:
mkdir package
sfdx force:mdapi:retrieve -s -r package/ -u jeff@salesforce.com -p sfdxTransfer
You’ll then get a package in the directory you specified.
Convert the package to an SFDX project
With SFDX: sfdx force:mdapi:convert -r package/
This will create new files from the old package data.
Push to a Scratch Org
And last step is to push to a scratch org.
sfdx force:source:push will push to your default scratch org.
You will likely get an error or two, just read through and resolve. For example if you’re missing a field on an object you will have to create that in your scratch org. Use sfdx force:org:open to open your scratch org and sfdx force:source:pull to pull changes that you make.