Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [test-setup]

The tag has no usage guidance.

1
vote
1answer
87 views

Attempt to de-reference a null object when calling class method from Test class

I am trying to write a test method that calls a method in my class to get some configuration data. The method in my class returns a Map. From my test method, when I call the method in my class, I ...
-1
votes
1answer
25 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;} ...
0
votes
0answers
32 views

Writing test Class - Code Coverage 0% [duplicate]

Working on creating a test class for my class in my sandbox and I am receiving a code coverage 0% in the dev console. The console isn't highlightning the lines that need to be covered in red either. ...
-1
votes
0answers
23 views

How to Write Test Class for REST API Response Class [duplicate]

I have a post method in REST API. Once the record is created, I am sending a response to user. In order to send response, I have created a class that checks if the incoming payload was in JSON format, ...
0
votes
1answer
19 views

How to perform a load test on a triggered send

I'm looking to perform a load test on a triggered send by pushing ~160k records through the trigger. For the test, we are planning on taking a block of live records and replacing the email address ...
0
votes
0answers
17 views

Writing a test class for content document link trigger [duplicate]

How would I write a test class for this trigger? I have found a trigger in another stack exchange question and have tested in the sandbox, but am unable to deploy without a test class. Any tips? ...
0
votes
2answers
74 views

How do I create multiple records in the test data factory of a salesforce test class?

I have something like this but I want more records of this object to be created to be used in my test class public static Lead createLead(Account new Account) { Lead newLead = new Lead(); ...
3
votes
2answers
62 views

'List has no rows for assignment to SObject' Mystery

I have the following test class: @isTest private class PMTools_AppliedTechExtensionTest { @TestSetup static void SetupTestData(){ Account testAccount = new Account( ...
1
vote
1answer
35 views

Test Lead has OwnerId but Cannot Access Owner Fields

I have the following test setup method: @TestSetup public static void testSetup() { //system.runAs(u) { //JITTriggerManagement.toggleTrigger('Lead'); Lead l = new Lead( ...
0
votes
0answers
21 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 ...
1
vote
1answer
92 views

ERROR: No AuthInfo found for name [object Object]

Ad the title described, I have the following error: ERROR: No AuthInfo found for name [object Object]. What i did was to install a whole new clean visual studio code, with the related salesforce ...
0
votes
2answers
45 views

I have worked on the test class with 97% code coverage and now i would to try it with using @testsetup can any one please help me? [closed]

@istest(SeeAllData=false) public class Testclassforaddingpli { //public list<Proposal_Line_Item__c> prolist = new list<Proposal_Line_Item__c>(); @istest public static void ...
0
votes
2answers
57 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 ...
3
votes
2answers
134 views

How is it possible for @TestSetup to effect test result?

While refactoring a test to make it more consistent with the style of our other tests, a colleague came upon something really weird. The original test created the test account in @TestSetup, like so: ...
2
votes
2answers
43 views

Accessing Variables from a Parent Class

I am attempting to set up tests for my APEX classes, more specifically, I am attempting to create a parent class that includes a prepareDatabase function that creates data for my tests, and this ...
0
votes
1answer
32 views

My Test Class Isn't Passing

I have a test class which is testing a controller but I cannot get the test to pass. Here is the controller class: //a controller class to get incidents for display on VF page and then //anonymise ...
0
votes
0answers
24 views

MIXED_DML @testSetup TestMethod [duplicate]

So I am seeing a very weird issue. I am getting a MIXED_DML error in one of my test methods. In the @testSetup annotated method, I am indeed perform a mixed dml transaction (shame on me). However, ...
1
vote
1answer
20 views

Can't get my test class to pass

I have a controller which I am trying to write a test class for: //a controller class to get incidents for display on VF page and then //anonymise the incidents and related contacts public class ...
0
votes
0answers
45 views

Hello i am not able to get the result from this test class [duplicate]

I am trying to update the email in my Test class but it is not happening please help me. This is my class- global class PrepareSandboxPostCopy_Batch implements Database.Batchable { String query; ...
2
votes
3answers
94 views

How do I pass record IDs from testSetup to isTest methods?

I want to create data in a test class that can be used by multiple test methods. However, for the test method to be able to access that test data, I need a way to pass the record IDs to from the @...
0
votes
1answer
65 views

Test Coverage for Pattern Matcher in Apex

I have the below code in my controller Class in a Verify () function - public class SA_reCAPTCHA { private Reference__c Reference; public List<Reference__c> RefID = new List <...
0
votes
1answer
44 views

Any method to create a Conga Template record in APEX Test?

I am working to improve Apex code coverage and trying to create a placeholder Conga_Template__c record. The test will not call conga but will check for a valid conga template record in the database. ...
8
votes
2answers
537 views

@testSetup vs DataFactory?

When testing, how/when will @TestSetup annotation be preferable to a "DataFactory"? I understand how both works, but I don't see any case where I'd rather use the @testSetup annotation. I use this ...
2
votes
1answer
173 views

Test Class failing in production [closed]

I have a test class failing while validating it and its base class deployment to production. The test setup is creating several records in 2 objects (1 standard 1 custom) and inserting them as a ...
0
votes
1answer
24 views

A-B Test - clean random distribution

I´d like to use the AB Test function in the Email Studio. I´ve got one big sending data extension. That DE contains all subsrcibers from different countries. Now I want to test 2 different ...
1
vote
1answer
474 views

How to Test Omni-Channel User Service Presence in Apex Test Class

I have a class I need to write an apex test class for that uses the UserServicePresence object for Omni-Channel as a major filter for a SOQL query in the class. The majority of the logic in the class ...
1
vote
2answers
50 views

How many records can be created in TestSetup method in test class?

How many records can be created in Test Setup method in test class
1
vote
1answer
26 views

Case Number duplicates found for case insert in Test Class

I faced a weird scenario today. I have a @testSetup method for inserting my case records and then used another method to query those case records to fetch CaseNumber field and pass it to a JSON String ...
2
votes
2answers
98 views

Am I setting up a Pricebook Entry incorrectly?

Update with More Code: The Test Class contains: Product2 plc = new Product2(Name='My Product', ProductCode='PC-1'); insert plc; Id pricebookId = Test.getStandardPricebookId()...
4
votes
2answers
857 views

How do I create Test Data for an Org. Wide Email Address?

I need to create an Org. Wide Email address for my Test Class, and I can't seem to find documentation for this. One forum led me to believe it wasn't possible, but it wasn't clear if I was ...
2
votes
1answer
570 views

Test.startTest() in testSetup method

An year ago I asked a question regarding the advantages of using testSetUp annotation instead of having a method for common data and calling it in every test method. My main issue at the time with ...
1
vote
1answer
1k views

regarding External entry point

i have one custom field called Unique_Vendor_Id__c on account object (external id checkbox checked) and its auto-number. now in test class when i create account for test data Unique_Vendor_Id__c ...
1
vote
1answer
486 views

Empty picklist value is getting saved as null

I am trying test a piece of code by changing a Status__c field on Save_Attempt__c Object. I am explicitly setting the value of Status picklist to an empty string and not null but when I query, it's ...
8
votes
2answers
408 views

Testing with ApexMocks vs Stub API

We are looking into using ApexMocks to improve the tests in our managed package. The problem is that it looks like we will need to bring it into our package which will increase the number of classes/...
0
votes
2answers
123 views

How efficient is to use Future call in Test class?

We have scenario where we are trying to create test data in tetsSetup method. We wrote a test data creation script in Util method and marked it as future and calling it from testsetup method. Is it ...
0
votes
1answer
156 views

Batch test class not working!

I have managed to put together a batch test class using Trailhead, but it is not correct, all I need is for it to populate values in new custom fields with values in other fields all from the Account ...
0
votes
1answer
169 views

Is org data visibility(seeAllData = true) required for test method to create test data?

I am writing a test class for testing webservice callouts as a part of one of the challenges of Data Integration Specialist superbadge. Here I am creating test data by inserting some custom object ...
0
votes
0answers
60 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"...
2
votes
2answers
202 views

What is the scope and level of isolation of @TestSetup data in a test class?

I would like to use @TestSetup in my unit tests to create common data for each of my test methods: @isTest private class AwesomeTests { // how many awesome things to setup static final ...
1
vote
1answer
475 views

Can I use the @TestSetup from a separate test class?

I have a class I want to test that has an associated test class with it. I am wondering if I use a TestDataFactory class if the @TestSetup annotation will allow me to access the data inserted from my ...
0
votes
1answer
38 views

After update trigger fires from UI but not in test class

I've got a simple trigger written to update attributes of a child record when the value of the attribute in the related parent changes. The trigger works fine for actions triggered in the UI, but it ...
0
votes
1answer
40 views

Test class no inserting object

I have a test class that seems not to be inserting some setup objects I need for the test. My test class is as follows: @isTest(seealldata=false) private class Alertas_The_Influence_isTest{ public ...
0
votes
1answer
53 views

Test Class Having More Issues Setting Basic Dummy Info

I'm having issues with setting the dummy data as there are a lot of required fields on the system. I'm getting this error when attempting to create a dummy Marketing Source. And I apologize on the ...
3
votes
1answer
195 views

Do governor limits like Apex CPU time limit apply to @testSetup methods?

I have a test method written by a third party that occasionally results in Apex CPU time limit errors. The part of the method that includes setting up a semi-large amount of data on multiple objects (...
1
vote
1answer
689 views

What is the easiest way to test a journey?

I have a journey built and I'm wondering the easiest way to test it. Would you create a replicated test Data Extension and copy the journey?
0
votes
1answer
63 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
17 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> ...
1
vote
1answer
155 views

Test class works in sandbox, fails in production validation

I'm at a loss. I don't understand why my test class works fine in the sandbox (100% coverage), yet when I run a deployment validation in production, I get the following error for each test method: ...
0
votes
3answers
2k views

Using the same test setup for multiple test classes

So here's the situation, I have a lot of things that I want to test, and each of these things requires the same data to be present in the org. I was hoping to be able to use the @testSetup annotation ...
4
votes
1answer
905 views

Avoiding Governor limits on test classes

We have a custom application created on force.com platform which has a lot of unwanted SOQL Queries and DML Statements written in a poor format. We are trying to stabilize the code now and looking ...