A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Questions tagged [test-setup]

The tag has no usage guidance.

19 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
44 views

Apex Batch Test - works if I populate only one account, fails in setup with 2 accounts

I have written my first Apex batch processing class. It works when I manually create records and run it in my sandbox. It is very simple. We've added a set of fields that can have up to 3 values: '...
2
votes
0answers
161 views

Unit Test data setup is hitting Apex CPU time limit

I have written a set of methods in a test class that can be called to create and insert relational test data. I am using Test.StartTest() and Test.StopTest() to keep the operations for the test in ...
1
vote
0answers
89 views

Understanding coverage when @TestSetup is used in a test class

I have a Test class which include a method with @testSetup annottation. After saving this class it was added in list Overall Code Coverage like in the picture bottom. I was confused after that. When ...
0
votes
1answer
21 views

How to cover piece of code using test class which is checking if its sandbox or Production

I have below Peice of code which is chekcing if its sandbox then run If part else run Else part if(runningInASandbox()) { return getSsoRedirect('one', startUrl, ...
0
votes
0answers
28 views

Test Class - SOQL in Test Returns No Results using Database.Insert(RecordList,DML), but works using Database.Insert(RecordList)?

I am creating test coverage for a new Lead Process we've built for our company. To properly test this deployment, I need a list of Leads to show as being Inserted by our Pardot API connector user, and ...
0
votes
2answers
211 views

Ant deployment doesn't recognize updated test classes and fails

I have a small set of lightning components and related apex classes that I'm trying to deploy using ant. The first deployment was fine. I had to make a change and updated the apex class that has all ...
0
votes
0answers
73 views

Apex @testSetup

I have the below test but I can't figure out why the opportunity won't query. When I run this test class, the error I keep getting is "System.QueryException: List has no rows for assignment to SObject"...
0
votes
1answer
67 views

Running a test in developer console v.s. setup

I'm running a unit test in developer console and in setup and I appear to be getting two different results. Within the dev console, my unit tests appear to be passing. But when I run the tests in ...
0
votes
0answers
19 views

loading bulk data for testing gives : System.LimitException: Apex CPU time limit exceeded

I am trying to test my batch process by loading bulk data: I am creating the data as follows: List<Account> accounts = new List<Account>(); List<Account_Plan__c> ...
0
votes
0answers
104 views

How to fix unneeded Code Coverage?

I have a testclass with the following structure: @isTest public class UnitTests { @testSetup static void setupTestData(){ // insert some sObjects } @isTest static void ...
0
votes
0answers
81 views

Test class failure during execution from console, but not during deployment

I have test class that fails in production while executing it from the developer console, but when deploying other things it pass. Note, that it is not related to the user, same run/delpoyment is with ...
0
votes
2answers
44 views

Trigger's Test Case Help (Trigger Works fine)

I have 3 objects Master Contact, Master Volunteer_Project__c and Detail Participation__c. Means Participation__c is detail for both Master. Now One Volunteer_Project__c can have many Participation__c....
0
votes
1answer
81 views

I am not able to write Test class for below code

I am having class which is firing on trigger Before update Here is the class code public class UpdateAbscenceRecord { public static void UpdateAbsenceOnUpdate(Map<id,account> NewAccountMap,...
0
votes
1answer
279 views

Want to write test class for the QuoteLineItem Trigger

trigger QuoteLineItemTrigger on QuoteLineItem (after update) { if(Trigger.IsUpdate && trigger.isafter){ QuoteLineItemTriggersHandler objQuoteHandler = new ...
0
votes
0answers
257 views

Running Tests in Production WHILE Deploying to Production - Row Lock Error

In our test classes, we utilize testSetup methods that create and insert records in preparation for their use in the test methods of the class. I found today that if I'm running tests in Production ...
0
votes
0answers
1k views

StackTrace - External Entry point

When I run my test class by using a method marked with @testSetup annotation, I get into nullPointer exception and the stack trace is shown as - "External Entry Point". Suprisingly when I move the ...
0
votes
1answer
129 views

Losing all test coverage when testing individual class

I am writing tests for my apex classes. Usually I can test each test class individually from the developer console. When I run the idividual test my code coverage is 0% even if the class passed. My ...
-1
votes
0answers
32 views

Test Class for Aura variables

Can anyone help how to write the test class for below code public with Sharing class HBTGDM_TeamRecordHandler { @AuraEnabled public String fieldApiName ; @AuraEnabled public String ...
-2
votes
1answer
60 views

Writing a test class for methods

I am having troubles figuring out how to write the test class for the following method in my class. Any help would be greatly appreciated. public Oppty_Search_IntegrationOperation....