Questions about specific lines of code that need coverage or platform bugs. 75% of your Apex code must be covered by test classes. This tag is not intended for use when code coverage is simply lacking, but for scenarios where because of a particular configuration or system issue code coverage is ...

learn more… | top users | synonyms

0
votes
0answers
18 views

Having issues creating test units, parts of the code do no't validate

I am learning salesforce and have created classes and triggers which work just fine in sandbox but when I try to add them to production I get the code coverage error and it won't let me pass that, I ...
2
votes
0answers
26 views

Code coverage is 70% and I get a DUPLICATE_VALUE issue

Code coverage is 70% and when I dive into the problems I get a duplicate error. Please help I am new to writing triggers. Thank you ahead of time! Problem on several Lines Message: [object ...
2
votes
0answers
37 views

No test coverage on after insert trigger

I can't quite tell why code coverage is saying that there are 0 lines covered. My objective is that every time an Award is inserted, an Award Judging Criterion is inserted with a link to the Award. ...
2
votes
1answer
184 views

How does third party tool get the code coverage lines

Does anyone share the same feeling with me that the code coverage tool from third party - like mavensmate - knows which lines are covered are quite awesome? It is not just in detecting the code ...
6
votes
2answers
150 views

Are inactive triggers counted against test coverage?

We are in process of deploying a project to PROD and found that test coverage is coming up less then 75%. There are some triggers we have merged into single trigger. Question is: whether the ...
-3
votes
2answers
48 views

Help with Code coverage, Loop and if conditions

I'm unable to have code coverage. Wrote a test class that has 24% coverage. How should I test loops and conditional statements? Following is my Apex Class... public class OrderTrackingList{ ...
1
vote
1answer
33 views

Help with controller test class. First Attempt! [duplicate]

It's my first take on writing Test Class. Following is my Apex Class... public class OrderTrackingList{ public OrderTrackingList(ApexPages.StandardController controller) {} public ...
0
votes
1answer
25 views

Need Code Coverage for CRUD If Block, How can I achieve that?

Here is my Controller Code --- // creates a new Attachment__c record Attachment__c objAttach = new Attachment__c(); private Database.SaveResult saveCustomAttachment() { ...
1
vote
2answers
44 views

Need help with test class for my first trigger, have researched!

I am new to apex and SF and need help in writing a test class for my trigger. This trigger runs every time a Calender event is created and updates the scheduled date and status on Opportunity. The ...
0
votes
0answers
32 views

Code Coverage of test method

My code coverage is on 48%. below is my class with testmethod. I use API 27.0. public with sharing class CommonController { public static testmethod void test1() { ...
0
votes
3answers
95 views

Issue with Code coverage during deployment

Hello I am trying to deploy a Trigger and a Class from my Sandbox to production environment. I am running into Code coverage error. The code coverage when i look in the developer console says is 75% ...
1
vote
3answers
79 views

Is it possible to get 100% Apex code coverage all the time?

Is it possible to get 100% code coverage all the time by considering all cases such as positive/negative, bulk/single etc. Are there any cases which can't be covered by test classes? I often hear that ...
0
votes
0answers
26 views

Suggested Unit Testing Approach When Checking for XML Child Nodes

Unit testing is currently at 60% code coverage on a specific class. Many of the lines of code that aren't covered by tests look like the following: global class IFXIndividuals { global ...
3
votes
1answer
91 views

Aggregate Code Coverage Calculation

Given two classes with test classes: 400 testable lines: 200 covered 10 testable lines, 10 covered How will the test coverage be calculated? Average of the coverage for each class, or the ratio of ...
1
vote
1answer
126 views

Can some help me get coverage for the below trigger?

Trigger: Trigger copyEquipmentonsite on Unit_Placements_Sales__c(after insert, after update) { List<Services__c> sub=new List<Services__c>(); for(Unit_Placements_Sales__c u : ...
1
vote
1answer
53 views

Unit Tests max number of test methods in a class?

I have many unit test methods (30+) in a test class that cover my class well - setting up data, setting the page and controller, calling methods and setting properties, doing asserts. But when I look ...
0
votes
1answer
126 views

test class is not covering email messaging

trigger: trigger TaskCompletion on Task (after insert,after update){ IF(trigger.isinsert){ for (Task E : Trigger.new){ If((E.CreatedById != ...
0
votes
2answers
63 views

Help regarding test case code coverage

public with sharing class searchpn { //variables Public Id parentId; public Integer qliRowNum1{get;set;} public Integer qliRowNum{get;set;} public Integer finalRowNum{get;set;} ...
1
vote
3answers
160 views

0% code coverage Test APEX class

I have set up a simple APEX class that is an extension for a Visualforce page. The VF page has a commandButton that saves and takes you to a different page called "Congratulations.vfp" I have been ...
2
votes
1answer
65 views

I have this trigger and test class . why my test class cover 0%

trigger openTrigger on Project_Item__c (after insert,after update,after delete,after undelete) { Project_Item__c[] items; //Use Trigger.old For After Delete and The Others is Trigger.new ...
0
votes
0answers
88 views

Incorrect code coverage in developer console

I have an apex class called RelationshipTreeController (RTC for short) and a test class called RelationshipTreeControllerTest (RTCT for short). I have written a test method that calls the search() ...
0
votes
0answers
130 views

Get test coverage on lines that won't execute if Test.isRunningTest() is true

I was trying to write a test class for one of my classes. It has a condition which checks for whether the run is a test run or not. try { if(!test.isrunningtest()) { ...
0
votes
2answers
102 views

Saleforce Apex Test Coverage

Following is my Apex class: public class lastViewed{ public Datetime cDT; public String LongDate; public String firstname; public String lastname; public String userid; ...
4
votes
2answers
71 views

“Overall” missing in Production developer console Tests->Overall Code Coverage . How to bring it?

"Overall" missing in Production developer console Tests->Overall Code Coverage . How to bring it? When I try to evaluate the organization overall code coverage in production, I am seeing a difference ...
2
votes
3answers
1k views

Is the 75% code coverage requirement to deploy to production per class or overall?

My developer org's overall code coverage is 76%, but some classes are still 0% while others are 100%. Will I be able to deploy all my code or does Salesforce require a 75% coverage per class?
2
votes
2answers
74 views

Can't upload test class

I accidentally (but successfully) uploaded to production via change set an Apex Trigger, without also uploading a Apex Test Class (doh!). I have the test class created and ready to deploy, but I'm ...
3
votes
2answers
175 views

Is there any alternate way to find my organizations code coverage?

When I clicked "Estimate your organization's code coverage" in Apex Classes from Setup Menu, I got the following error. Why this error coming? Is there any other alternate approach to find my ...
2
votes
1answer
137 views

Covering send email code

Guys i am struggling to cover the below code in a test class. public void createAttachment(){ String[] toaddress; User usr=[SELECT id,Name,Email FROM User WHERE Name='test user' ...
1
vote
0answers
146 views

Assistance with a Test Class to increase code coverage

This is a follow up to my previous question of Is there anyway to deactivate a trigger in Prod when the minumum code coverage is not met. I am not an apex developer and I am the only SFDC Admin at my ...
1
vote
2answers
84 views

Is there anyway to deactivate a trigger in Prod when the minumum code coverage is not met

I am not an apex developer and I am the only SFDC Admin at my company. We are a smaller non-profit org and the directive is to use standard "out of the box" functionality which I can do with my ...
1
vote
2answers
51 views

TestMethod coverage for merge variable

is there any way to get code coverage for merge variables. For example: In Visualforce page I am using a string variable myDescription in value attribute. <apex:outputText ...
0
votes
1answer
48 views

I am not the getting the code coverage for the following lines shown in image

Here is my schedule class : global class Scheduler_class implements Schedulable{ public static String CRON_EXP = '0 00 00 * * ?'; //Every Day at Midnight global static String scheduleMe() { ...
0
votes
1answer
239 views

Developer Console not showing covered lines by test method

I want to know the lines of my apex class which are not covered by the test classes. I know its only possible in developer console now. But seems to be some issue there again. I ran all tests in ...
13
votes
6answers
1k views

Apex Code Coverage: Test classes are included with 0% in overall code coverage calculation

We are making heavy use of stub and mock objects in our Apex tests. Most of the time we are defining the mocks as inner classes of our test classes. We have noticed, that test classes, which do ...
0
votes
1answer
66 views

My code coverage stopped at 60% how can I increase code coverage to 100%

public class deleterecords1{ public List<sObjectWrapper> wrappers{get;set;} public deleterecords1(){ wrappers = getData(); } public void deleteRecords(){ ...
4
votes
2answers
460 views

My trigger is 100% covered, but I am not sure if I should deploy to production

I am new to apex and salesforce developing. I have written an apex trigger and a test class. The trigger compiles and I tested in my sandbox to make sure it does what I want. My test class runs ...
1
vote
0answers
83 views

Issue: Salesforce UI, Developer Console and Eclipse IDE shows different code coverage for the same class. Is anyone experienced this?

This is very much confusing and hard to believe which one is valid. Below screen shot describes the issue as the code coverage for one of the class "OpenDocumentsController" showing 100% (179/179) in ...
1
vote
0answers
47 views

why test coverage includes all classes and triggers when creating an unmanaged package with selected classes?

Trying to create an unmanaged package with few classes but i am getting the following error when i try to "Upload". There are other Apex classes and triggers in my free dev org for which i do not want ...
0
votes
0answers
77 views

Data displaying in Overall Code Coverage section in developer console is not consistent

The data displaying in Overall Code Coverage section in developer console is not consistent, but displays incorrect code coverage sometimes 100% and sometimes with lesser number. For example, ...
1
vote
1answer
125 views

How is Total code Coverage on ApexClass calculated

In developer Console all my classes are showing test coverage greater than 80%. But when I look at overall test coverage on ApexClasses page it shows at 74%. Any suggestions how is this calculated or ...
-1
votes
1answer
91 views

Help, with increasing code coverage with an apex class [closed]

I've got very basic experience in apex codes and pretty much cloned an existing one developed for us and modified it to run a similar process. I'm now stuck in terms of how I can go about fixing this ...
3
votes
1answer
183 views

Developer console Code Coverage

I am not able to view the classes/triggers which are not covered by test classes.It only shows the classes/triggers which are covered atleast one percent.I need to tackle test coverage of those ...
-3
votes
2answers
1k views

Urgent!!! Test Coverage for Batch Apex Class

I am a newbie in salesforce. I have a batch apex class. I wrote a test class for the class and my test method is passed but am not getting the code coverage. I have covered 42% of the code. Apex ...
0
votes
1answer
269 views

Test Class not passed

Here is my test bulkify test class and my actuall trigger handler methods. I dont know why but my code coverage is %76 and still it says test is not passed.. Is there anyone can help me about this ...
2
votes
1answer
122 views

How do I test cover simple JSON creation in a trigger?

I have an contact after trigger which collects data from Contact, add some personal, authentication pairs, and updates a 3rd party system. While the insertion of account/contact in the test class is ...
3
votes
3answers
250 views

Code Coverage report for all classes

Winter 14 release removed Code Coverage column from list of class and triggers. Did anyone found any (nice) workaround to check Code Coverage of ALL classes?
0
votes
2answers
88 views

Lack of Apex code Coverage

I'm trying to get a code to work that will set map an opportunity owner to the account owner but I'm getting failures for two lines. Any ideas? Broken lines start with a "**" trigger ...
1
vote
1answer
371 views

Help with testing a Case Email Trigger

Someone on the forum was gracious enough to help me with the below code. Basically, it checks if a case is closed and there is incoming email, it will then clone the case. Problem is how can I ...
3
votes
4answers
1k views

Why is my trigger receiving 0% code coverage when the test class runs correctly?

I'm trying to create a few triggers that prevent most of our org from deleting various items in our cases and opportunities (such as activities, case comments, etc.) I have been able to create the ...
3
votes
1answer
421 views

How to get 100% Code coverage when testing scheduler apex class

I have code that I would like to test and get 100%. When I run the test ((27% code coverage) the code that does not get processed is from - for (event eWO : eventWorkOrderList) { But when I run the ...