Linked Questions

-2 votes
1 answer
5k 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 }
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....
user avatar
  • 1
-3 votes
1 answer
1k 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(...
user avatar
-3 votes
1 answer
1k 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> ...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
  • 15
0 votes
1 answer
1k 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 ...
user avatar
0 votes
1 answer
1k 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....
user avatar
-2 votes
1 answer
626 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&...
user avatar
  • 1
0 votes
1 answer
795 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){ ...
user avatar
0 votes
1 answer
614 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 ...
user avatar
  • 25
0 votes
1 answer
288 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; } }
user avatar
0 votes
0 answers
481 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 ...
user avatar
0 votes
1 answer
362 views

Test Class Coverage for Apex Controller [duplicate]

I need help in writing test class for following apex class. Could anyone please suggest how to create test data,test the following method defined in apex class with positive and negative scenarios and ...
user avatar
  • 13
-1 votes
1 answer
360 views

How to cover the SETENDPOINT kind of lines in test class [duplicate]

**APEX-CLASS** public class TriggerFlodataWorkflowController { public string inputIds{get;set;} public List<String> selectedNames{get;set;} public List<String> selectedIds{get;set;} ...
user avatar
0 votes
2 answers
422 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 ...
user avatar

15 30 50 per page
1
2 3 4 5
12