3
By default your test class can't read the records of your org.
So in your method, if(testTranscripts1.size()>0) returns false and nothing happens.
To allow it to see the record, you have to annotate your method with @isTest(SeeAllData=true).
However, using SeeAllData is not a good idea since if anyone deletes the record named 00000089 in the org, your ...
1
The only way to properly cover the catch block is to somehow insert bad data and then try to update the record. Since you use a query to effectively verify the ID is valid and the user has read access to the record, your only real alternative is to create a fake user that has a limited DML operation (not System Administrator), so that the update will fail. ...
1
Disable retrieve-test-code-coverage from settings and try this vscode extension.
You can get code coverage as in Developer Console in less time.
https://marketplace.visualstudio.com/items?itemName=RaffaelePreziosi.apexgetcoverage
1
In my case, I was trying to get Assignment Rules from readMetadata and here's how I mocked it:
private class WebServiceMockImpl implements WebServiceMock
{
public void doInvoke(
Object stub, Object request, Map<String, Object> response,
String endpoint, String soapAction, String requestName,
String responseNS, String ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
code-coverage × 1088apex × 699
unit-test × 679
trigger × 160
failing-tests × 79
deployment × 54
batch × 44
visualforce × 37
class × 36
code × 36
callout × 24
httpcalloutmock × 22
test-setup × 22
scheduled-apex × 20
salesforcedx × 18
rest-api × 16
developer-console × 16
controller × 15
wrapper-class × 11
community × 10
schedulebatch × 10
json × 9
apexrest × 9
exception × 9
tooling-api × 9