New answers tagged code-coverage
1
vote
Test Code Coverage - Delete DML catch block
You can use the Test.isRunningTest method to check if the code is running in a test context and then throw a custom exception.
For example, you can modify your main class code like this:
@AuraEnabled
...
0
votes
Test class for batch with another class called in it: Batch has 100%, but called class only 24% coverage
Sorry for bothering you, it was a after Inset trigger that I was unaware of which was updating a field value, so problem was solved after updating field value after insert.
Top 50 recent answers are included
Related Tags
code-coverage × 1311apex × 863
unit-test × 818
trigger × 191
failing-tests × 103
deployment × 64
batch × 53
class × 41
visualforce × 40
code × 38
test-setup × 33
callout × 25
scheduled-apex × 25
httpcalloutmock × 24
salesforcedx × 20
developer-console × 20
rest-api × 17
controller × 17
apextestrunresult × 15
wrapper-class × 14
change-set × 14
try-catch × 14
before-trigger × 13
schedulebatch × 13
soql × 12