Skip to main content

New answers tagged

0 votes

apex test class for remote action callable

Couple of observations seeAllData=true (not a best practice), recommended is false use testSetup to create test data, use these test record id's to pass as params, hardcoding id's is a bad practice ...
Edwin Raymond -forcetree.com's user avatar
2 votes
Accepted

Test Class Passes, but Should Fail

When creating a user via the UI, the UserRoleId is set explicitly. This causes a mixed DML operation. However, specifying the UserRoleId was not necessary, in my case, because the user role was ...
Diego's user avatar
  • 525
0 votes

Apex Test in VS Code: "Faye client generated a transport:down event"

Just got this same error. A test that normally has ~150ms was hanging for about a minute. THen it also automagically resolved itself and ran correctly. Found this trailhead answer which also seems to ...
Steven Trumble's user avatar
0 votes

Help with Test Class - I Really Don't Know What To Do

In the initial example, the instantiation of inner classes was incorrect. Inner classes in Java (and similarly in Apex) should be instantiated using an instance of the outer class. In my revised ...
Jacob Crandall's user avatar
1 vote

Test Class Passes, but Should Fail

@IsTest static void shareClientOnCreatingPortalUser() { Client__c client = TestFactory.createClient(); Account account = TestFactory.draftPersonAccount(); account.Client__c = client.Id; ...
YRS's user avatar
  • 51
0 votes

How to properly test batch apex classes with the seealldata equals true

In addition to the above I also had to add this to the query +(Test.isRunningTest()?' LIMIT 5':'');
Chinomso Johnson's user avatar
2 votes
Accepted

How to properly test batch apex classes with the seealldata equals true

First, I'd suggest changing your execute(SchedulableContext) as follows: public void execute(SchedulableContext SC) { Database.executeBatch(this); } The reason why is that we're going to modify ...
sfdcfox's user avatar
  • 497k
3 votes

I need help writing a test for a trigger on OpportunityLineItem

Testing OpportunityLineItem is a bit of a pain. I think you were on the right track with trying to fetch the Standard Price Book, but doing the insert isn't quite what you want to do here. Salesforce ...
Derek F's user avatar
  • 62.7k
0 votes

How to do an Apex class test coverage

i did it, i still confuse but i did it, here is the code: @isTest public class Taxa_datadasTest { @isTest static void testTaxa_datadas() { // Given Taxa_datadas.InputVar input = new ...
Gabriel Euzebio's user avatar
1 vote

Testmethod support for record-triggered flows with scheduled paths

I think the best you can do is put the complete scheduled path logic into an autolaunched subflow and then test it with apex as described in this answer: Map<String, Object> inputs = new Map<...
smukov's user avatar
  • 5,613
-1 votes

I have written a apex trigger on task and want a test class code

You may use this sample code to cover your apex trigger code. https://www.decodeforce.com/code/-O-iLf4LtAsb0C0fXIFO
george thomas's user avatar
3 votes

Update Last Modified Date One day before in Test Class

If the code you're testing doesn't need to query these records, this can be done via JSON deserialization. If the code you're testing does need to query these records, it can be done with a CSV file ...
Derek F's user avatar
  • 62.7k

Top 50 recent answers are included