New answers tagged code-coverage
0
votes
Accepted
Test class for covering running user current application info
First principles:
UserAppInfo is not considered as metadata available to a testmethod. It is an SObject that must be mocked (like Account or Opportunity)
Now, you might think you could mock ...
1
vote
Accepted
How to write Apex unit test for a function that fetches meta data?
I'm assuming you are wanting to deploy this as a managed package, and hence why you do not know if the target organization would have any custom objects? If so, then I would make the suggestion of ...
1
vote
Accepted
How to get Test Coverage on a Simple Wrapper Class
You are missing testing the actual code that does work --
public static WebhookWrapper parse(String json) {
return (WebhookWrapper) System.JSON.deserialize(json, WebhookWrapper.class);
}
You need ...
0
votes
How to set a Date in apex test class?
Another option is using system.today().addDays(10)
acc.effectiveDate__c = System.today().addDays(10);
1
vote
Test Method Issue for removing duplicates from List
The signature of the method is to accept List<Sobjects>, But you are passing the list <String>. Can you try passing List<Sobject> to the method.
0
votes
Visual representation code coverage in VSCode
You can get the code coverage as in Developer Console (code coverage for each test method) with this extension.
Disable retrieve-test-code-coverage from settings if you use it.
https://marketplace....
Top 50 recent answers are included
Related Tags
code-coverage × 1228apex × 810
unit-test × 769
trigger × 181
failing-tests × 85
deployment × 60
batch × 51
visualforce × 41
class × 41
code × 37
test-setup × 28
callout × 25
scheduled-apex × 22
httpcalloutmock × 22
salesforcedx × 20
developer-console × 20
controller × 17
rest-api × 16
wrapper-class × 13
change-set × 13
json × 11
before-trigger × 11
schedulebatch × 11
soql × 10
sandbox × 10