codeLive: Writing Effective Apex Tests

  Рет қаралды 3,512

Salesforce Developers

Salesforce Developers

Күн бұрын

Пікірлер: 6
@PieterJacob
@PieterJacob 7 ай бұрын
I like to see you keep your test classes private. I always recommend this since tests should never interfere with production code.
@AlbaRivasSalesforce
@AlbaRivasSalesforce 10 ай бұрын
Note on using fake Ids: I was wrong!! --> standard objects Id prefixes don't change from org to org, but custom objects do, and I had completely forgotten this. This is a solution to get a fake Id dynamically, that won't fail when you move the test to a different org: /** * @description getFakeId * @summary Generates a record Id for an SObjectType without having to insert a record. * @param sobjType The Schema.SObjectType * @param startNumber * @return String value */ public static String getFakeId(Schema.SObjectType sobjType, Integer startNumber) { String result = String.valueOf(startNumber++); return sobjType.getDescribe().getKeyPrefix() + '0'.repeat(12 - result.length()) + result; } You can also check salesforce.stackexchange.com/questions/21137/creating-unit-tests-without-interacting-with-the-database-creating-fake-ids
10 ай бұрын
Live starts at 14:59. You're welcome.
@philw4740
@philw4740 10 ай бұрын
Glad to see something about fake IDs, but you seemed to miss covering mocking methods and classes. You stuck with static methods being tested, which, as you know, cannot be mocked. It would be good to do a session focused on a unit testing mocking framework.
@AlbaRivasSalesforce
@AlbaRivasSalesforce 5 ай бұрын
Yes!! That's my plan, when my other priorities let me :)
@petargechev1852
@petargechev1852 10 ай бұрын
Let's go :)
codeLive: How to Optimize Flows Using Lightning Flow Scanner
52:40
Salesforce Developers
Рет қаралды 4,2 М.
Salesforce Developer Tutorial - The Complete Guide to Apex Tests in 2024
1:45:37
Coding With The Force
Рет қаралды 9 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
codeLive: Implementing a Test Data Builder with Domain Builder
53:41
Salesforce Developers
Рет қаралды 1,6 М.
TDD Revisited - Ian Cooper - NDC Porto 2023
1:13:26
NDC Conferences
Рет қаралды 18 М.
Writing Test Classes in Salesforce
40:24
Salesforce Apex Hours
Рет қаралды 127 М.
TDD Is A BROKEN Practice
17:14
Continuous Delivery
Рет қаралды 32 М.
Mocking with the Stub Provider | codeLive
1:07:06
Salesforce Developers
Рет қаралды 3,4 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 918 М.
codeLive: How To Set Up Pre-Chat Forms For Agentforce
1:08:20
Salesforce Developers
Рет қаралды 1,6 М.
C# Unit Testing - Full Course - Write Unit Tests in C# like a pro!
1:22:12
tutorialsEU - C#
Рет қаралды 52 М.
Salesforce API Fundamentals
37:51
Salesforce Developers
Рет қаралды 56 М.
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН