Linked Questions

-2 votes
1 answer
19k views

Example test class cover Catch block catch ( exception ex ) [duplicate]

I am looking for an example of a test class where you cover the catch (DmlException e) { //Code } also catch (Exception e) { //Code }
Yonas Jb's user avatar
-3 votes
1 answer
4k views

Unable to cover test class for history object [duplicate]

Here is my test class public class BoothChangeReportCtrl { @auraEnabled public static List<BoothChangeDetail> getBoothChangeData(){ List<BoothChangeDetail> ...
RAHUL KUMAR's user avatar
0 votes
1 answer
2k views

Batch Test class not calling execute method [duplicate]

I have created below batch apex class. I have also created test class for this. But this test class is only covering 27% of batch apex class. Also, it is not calling execute method of batch apex class....
DRules's user avatar
  • 1
-3 votes
1 answer
2k views

Test class for sobject record type [duplicate]

I am trying to cover the below class. I am getting 71%. Can you please let me know how to cover . public class OpportunityRecordTypeSelectionCtr { @AuraEnabled public static string findRecordTypes(...
SFDC Guest's user avatar
0 votes
1 answer
2k views

How to cover a for loop in Apex Test? [duplicate]

the for loop is not being covered... I would like to know why. Thanks! Here the test: @IsTest public static void testSaveDistriverloren() { Priority_Distribution__c fetchPd = new ...
gaby sanchez's user avatar
-1 votes
1 answer
2k views

how can you increase code coverage without modifying test class? [duplicate]

If class has 74.5 % coverage then how can we increase 0.5% coverage without modifying test class?
Jarvis's user avatar
  • 1
0 votes
1 answer
907 views

how to write Test class for generate Random String method present in a class in salesforce [duplicate]

@AuraEnabled public static Integer generateRandomString() { try{ return Math.round((Math.random() * (900000) + 100000)); } catch (Exception e) { throw e; } }
Swarnim's user avatar
0 votes
1 answer
2k views

Code Coverage Failure Your code coverage is 73%. You need at least 75% coverage to complete this deployment [duplicate]

I did run all tests in my sandbox and also tried to run them each individually - the overall avg code coverage is around 88%. However, when i try to validate my change set in prod, it is throwing an ...
SMorse's user avatar
  • 49
0 votes
1 answer
2k views

how to write test class for batch class ? this covers only 44% [duplicate]

how to write test class for batch class ? this covers only 44% global Class Batchsample implements Database.Batchable<sObject>{ global Database.QueryLocator start(Database....
G Naveen Kumar's user avatar
0 votes
1 answer
2k views

How do you write a test for a class that clones? [duplicate]

I have the following code that clones an asset and its' children... public class Cloner { public Asset root_asset { get; set; } public Asset cloned_root_asset {get; set; } public ...
coder42's user avatar
  • 15
0 votes
1 answer
2k views

Salesforce Aura component controller apex test class [duplicate]

Having some issues creating a test class for the controller. public without sharing class DeleteFilesCtrl { @AuraEnabled public static List<FilesWrap> getFiles(string objectId){ ...
Haseeb Ahmad's user avatar
-2 votes
1 answer
1k views

Test class for event object [duplicate]

Please help me to write test class for event object. I am getting only 25% code coverage. // Method to validate start and End Time on events public static void ValidateStartEndTime(List<Event&...
Sohel's user avatar
  • 1
0 votes
1 answer
1k views

How to cover the constructor in the test class of the salesforce [duplicate]

I have completed almost around 71 percent of my test coverage ,,but not sure how to cover the constructor in my test class can anyone help me out. Below is my constructor. public String oppId {get;set;...
user avatar
0 votes
2 answers
898 views

Test class for trigger on Opportunity Object [duplicate]

@istest public class Test_TriggerOpportunity { private static testmethod void TestOnOpp(){ List<Opportunity> OppList=new LIst<Opportunity>(); Opportunity Opp=new ...
sai kamal's user avatar
0 votes
0 answers
868 views

Need Help with a test class to my apex class that attaches a Visualforce Page pdf to the quote [duplicate]

I found a way to write an apex class that attaches my quote which is generated by an vf page as a pdf to my quote object. Writing the test class is even a bigger problem for me. I get to 36% coverage ...
Thomas Kayser-Eichberg's user avatar

15 30 50 per page
1
2 3 4 5
12