A unit test is code that is written and executed to test a specific portion/unit of source code. Unit tests are class methods with the testMethod modifier or @isTest annotation and are usually placed in separate test classes annotated with the @isTest annotation. Code that is executed by unit ...

learn more… | top users | synonyms (3)

0
votes
0answers
27 views

Need some help please with pagination testing

I have 69% coverage on my controller, everything is covered accept the pagination. I need some guidance as I'm pretty new to Apex this is my second controller I've ever written. I will include the ...
0
votes
0answers
30 views

Can we use : Disable parallel apex testing option in production [duplicate]

Can any one help me out? On opportunitylineitem there are triggers and apex classes. Now I have written another trigger on the same class. All the test classes have above 75% code coverage. The ...
-1
votes
0answers
35 views

System.DmlException: Insert failed CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY,at production

Can any one help me out with this Errors.I have a trigger on opportunitylineitem and written a test class.When I deploy the trigger I get different Error .Any help very much appreciated. All the ...
2
votes
2answers
37 views

Writing Test Class for Apex Email Batch Job

I need help writing test cases for an email batch job. In the batch job, the users associated with the Franchisee__c field (a Lookup to User) from the custom object Store_App_Proc__c are selected and ...
1
vote
2answers
25 views

OpportunityLineItem in test classes

I am trying to insert OpportunityLineItem record in my test class but unable to insert. Account acc = new Account(Name = 'Test'); insert acc; Opportunity oppObj = new Opportunity(Name = ...
0
votes
2answers
25 views

Apex Trigger Test Class Issue

I wrote a trigger that works, and wrote a test class, but for some reason in the developer console in the code coverage list my trigger doesn't show up. When I tried to deploy the trigger to ...
0
votes
2answers
32 views

Test class Code coverage gets varied

Can any one let me know why the test class code coverage gets varied. 1)When I test individual testclass (controller) in the sandbox the code coverage shows as 35% only . 2)when I Run all the test ...
5
votes
2answers
123 views

Variable is not visible in test class

Can any one help me on this Error as **Variable is not visible** in a test class.Any help very much appreciated. Code : public with sharing class InvoiceController { List<wrapperClass> ...
2
votes
1answer
45 views

What's Wrong With This Apex Code (intent - to delete spam Leads)

I'm still pretty new to programming and especially to SalesForce programming, but I would have expected this suite of trigger, handler class, and test class to: test as expected and show the test ...
3
votes
2answers
60 views

Unit Test is Providing 0% Coverage for Apex Trigger

New to Apex here. I cobbled together a trigger that creates a new task whenever a certain type of opportunity is Closed - Lost, but I can't figure out how to get ANY coverage with a unit test. Does ...
-1
votes
1answer
25 views

IF Condition in test class

Can any one help me how to get the IF condition covered in test class.Any help very much appreciated. Code : public List<wrapperClass> getappointmentList1 (){ wrapperClass tempObj1 ...
2
votes
4answers
34 views

Simulate DML error in Unit test

I have a piece of code which upserts some objects. My code is robust enough to handle any DML failures. But i want to test it out in Unit tests. Is there a way i can simulate DML failures? General ...
0
votes
0answers
45 views

Apex Trigger Has 0% Test Coverage - What Am I Doing Wrong Here?

New to Apex here and having trouble getting ANY test coverage on a simple trigger I cobbled together to create new tasks when opportunities are Closed - Lost. Does anyone see what I am doing wrong ...
-2
votes
1answer
39 views

Wrapper class IF Condition are not getting covered in a test class [on hold]

Can any one help me out why the Wrapper class IF Condition are not getting covered in a test class.Their are Rollup summary field and formula fields ,Checkbox as pick.How to call them in a wrapper ...
-3
votes
1answer
35 views

Rollup Summary Fields and Formula Fields are not writable but how to call them in test class

Can any one help me out with test class code coverage .I have written a test class for a controller having wrapper class and their are rollup summary and formula fields which are not writable but how ...
1
vote
1answer
37 views

Approval Process Test Class

I have created a visualforce page which has records of pending approval processes and that page has buttons which approve/ reject a request. Please guide how will I have to write test class for it ...
-1
votes
1answer
18 views

Constructor not defined: [Asia1Activation].<Constructor>() at line 27 column 31

I have a class that looks like this: public class Asia1Activation { public Asia1__c thisAsia1 {get; set;} public Boolean isSuccess {get; set;} public Boolean isActivated {get; set;} ...
-1
votes
2answers
24 views

Issue with Extension Code Coverage

I have an Extension that works perfectly but the Test Class only has 65% code coverage. I cannot figure out why I don't have 100% (or at least 75%). Any help is greatly appreciated! Extension Class ...
1
vote
1answer
31 views

Test class fails throws different types of error as :STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product

Can any one help me out with test class code coverage .I have written a test class for a controller having wrapper class,but the code covearage is zero. Any help very much appreciated. Different ...
0
votes
2answers
26 views

Trigger not showing up in code coverage list

I created a trigger and in order to deploy it to production it needs at least 1% code coverage. I wrote the test class for the trigger, but I'm having a weird issue where the trigger is not showing up ...
0
votes
1answer
14 views

Attachment Trigger Test Class

Can you please help me with Test Class regarding Attachment Trigger I have. Whenever I run Test Class I get this error below. System.NullPointerException: Attempt to de-reference a null object ...
-1
votes
2answers
26 views

Error Too many SOQL queries: 101 for trigger

I am getting this error Too many SOQL queries: 101 for this trigger when I tried to push it into production. Can anybody please tell what is wrong in the script below. I will really appreciate any ...
2
votes
1answer
34 views

Getting error while inserting test data in test class

I have developed below test class but not getting why i am getting below error, System.NullPointerException: Attempt to de-reference a null object.. the id i am passing has having the value..any ...
-1
votes
2answers
36 views

how to cover catch block in this method in test class

public pagereference savePassword() { if((objAccountTemp.Contact_Name_1__c != null && objAccountTemp.Contact_Name_1__c != '' && objAccountTemp.Affiliate_User_Name__c != null ...
0
votes
0answers
19 views

Test class for a controller having wrapper class,code coverage appears Zero

Can any one help me out with test class code coverage .I have written a test class for a controller having wrapper class,but the code covearage in the test class appears Zero and the overall code ...
-1
votes
0answers
21 views

Code coverage in Test class appears only 4%

Can any one help me out with test class code coverage .I have written a test class for a controller,but the code covearage in the test class appears only 4% and the overall code coverage is 80%. When ...
3
votes
1answer
17 views

What do I assert in this test for a scheduled class?

This is my Scheduler class. global class LeadSummary_Scheduler implements Schedulable{ global void execute(SchedulableContext sc) { getCreatedLeadsSummary gcls = new ...
2
votes
2answers
65 views

Error in test class as : Entity is not api accessible

Can any one let me know why is this ERROR occuring as Error Error: Compile Error: Entity is not api accessible at line 2 column 8 COde @istest Public class TestInvoiceController{ static ...
1
vote
2answers
24 views

Inbound Change set error as:Average test coverage across all Apex Classes and Triggers is 71%

Can any one help me with this Error ,Im facing with these three diffent types of Error. In DC it shows 80% overall coverage in sandbox when we move in to production it say it has only 71% overall ...
0
votes
1answer
20 views

Error in Test Class as :FIELD_INTEGRITY_EXCEPTION

Can any one help me out with this Error as : System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: PricebookEntryId, ...
0
votes
2answers
32 views

Inbound Change Set Error as :Code Coverage Failure

Can any one help me out with this Error : I have deployed the Visual force page and the controller .The outbound change set went successful. At Inbound change set I get an Error as : Code ...
0
votes
0answers
19 views

How could I test a BusinessHours class functionality with unit tests

I am trying to write a unit test for the following method, public static DateTime addBusinessDays(DateTime startDate, Integer numberOfDays, String businessHoursName){ Integer ...
0
votes
0answers
31 views

test coverage for insert trigger

I have been trying for code coverage for the trigger, not sure what's wrong. please help. here is my trigger: trigger AppendAccountName on Opportunity (before insert) { List<Opportunity> opps ...
0
votes
1answer
27 views

Code Coverage for PieWedgeData

I can run this code in Sandbox, and I see the chart with all the results, how ever when I deploy it , it says fail to upload into production since 72 percent code coverage. why does this gives me no ...
4
votes
1answer
239 views

Too many query 101

I was trying to deploy a trigger from sandbox to production but was unable to do so as test run was throwing error Too many SOQL query. I tried all the best practices to avoid error too many soql ...
0
votes
0answers
25 views

test class help

I am trying to write a test class for a web service class and i am not able to get the full code coverage can any one guide me with this would be of great help Class : global class ...
-1
votes
1answer
40 views

Constructor not defined error in batch class

I am testing the scheduled batch class in salesforce, during which i am getting the below error : " Error: Compile Error: Constructor not defined: [LicenseOptimizer_BatchClass].(String) at line ...
0
votes
2answers
53 views

code coverage 0%

I got an error in the inbound change sets in my production mode and found out that my code coverage is 0%. I created an Apex Class over in a sanbox and I need to get the code coverage to reach 75% ...
1
vote
2answers
49 views

Test class for batch is not covering the execute method

I have test class for a batch the test class is not covering the execute method of batch. Does anyone have any idea what is the reason for this. My batch class : global class ...
0
votes
1answer
7 views

HaoIDE: Component is not active (Run Test Class)

Using the HaoIDE add-on for SublimeText 3 I'm having an issue when I attempt to "Run Test Class" from the context menu, it seems to be greyed out and when I use the hot key (Ctrl+Alt+T) I see an error ...
0
votes
1answer
18 views

System.debug breaks after INSERT

So I'm currently restructuring our Unit Test framework/pattern because it needs it and because I'm trying to track down an issue and at this point I've broken it down as simply as I can and still ...
3
votes
1answer
24 views

How to Create Archived Task

I need to test an archived task in my test method. According to Salesforce it will be archived if it is closed and activity date is older than 365 days. Yet this does not work: static testMethod void ...
1
vote
1answer
47 views

Problem in emp test class

Class: global with sharing class emprolExtensionNew { public Contact[] Availablerols {get;set;} public rol__c[] shoppingCart{get; set;} public emp__c theemp {get; set;} public ...
0
votes
1answer
40 views

Test Class Coverage for Get Property

I used a get property in a controller how can I get the coverage for that method in my test class My Controller: public class VisitRaisedDateTime { public String RecordId; public Decimal tvalue; ...
3
votes
0answers
33 views

Code Coverage in one big class vs multiple smaller classes

I'm having a very odd issue pop up wherein if I put all 75 of my account testMethods in one class, I get less than stellar coverage (maybe 70%) but if I split those testMethods up into 8-10 smaller ...
0
votes
2answers
20 views

Error: Compile Error: Method does not exist or incorrect signature when attempting to use a method from a class?

I'm attempting to build my first test, which is for a trigger I am trying to push to production and running into a large number of issues. The first an foremost being that the trigger at the beginning ...
1
vote
0answers
29 views

Test Method for callout in Future method

I have a trigger on Account. On Account insert, I am sending a callout through future method. I am trying to write a test class for this but I am getting either of these two errors - 1) You have ...
1
vote
2answers
40 views

Lead conversion unit tests throw errors for validation rules that use custom settings

I'm running into an odd issue with some of my unit tests & can't seem to find out what exactly is causing it the problem. Several of my unit tests revolve around converting a lead to an account ...
0
votes
1answer
25 views

I have created a trigger, which generate's a random string, Please can any one help in writing the test class?

trigger setGuid on dftly_app_contact__c (before insert) { For (dftly_app_contact__c dac: Trigger.new){ Blob b = Crypto.GenerateAESKey(128); String h = EncodingUtil.ConvertTohex(b); ...
4
votes
1answer
30 views

Test.StopTest Not Resetting Limits?

I have a test running in API Version 29. I am actively testing against governor limits and I think I am running into a bug. My test has the following sequence: //setup Test.startTest(); // ...