Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Exam Platform Developer II Topic 7 Question 96 Discussion

Actual exam question for Salesforce's Platform Developer II exam
Question #: 96
Topic #: 7
[All Platform Developer II Questions]

A company notices that their unit tests in a test class with many methods to create many records for prerequisite reference data are slow.

What can a developer to do address the issue?

Show Suggested Answer Hide Answer
Suggested Answer: B, C

Contribute your Thoughts:

Anastacia
28 days ago
Option D? Really? Move the data setup to the constructor? That's like putting the cart before the horse. What is this, amateur hour?
upvoted 0 times
Mauricio
3 days ago
A) Turn off triggers, flows, and validations when running tests.
upvoted 0 times
...
...
Theresia
1 months ago
Hmm, I'm torn between B and C. Maybe I'll just flip a coin. Or better yet, I'll ask the developer sitting next to me. They'll definitely know the right answer.
upvoted 0 times
Emile
12 days ago
C) Move the prerequisite reference data setup to a @testSetup method in the test class.
upvoted 0 times
...
Mendy
14 days ago
B) Move the prerequisite reference data setup to a TestDataFactory and call that from each test method.
upvoted 0 times
...
Janae
16 days ago
A) Turn off triggers, flows, and validations when running tests.
upvoted 0 times
...
...
Julianna
1 months ago
I'm a big fan of Option A. Turning off all those triggers, flows, and validations will definitely speed things up. Who needs all that extra stuff anyway?
upvoted 0 times
William
10 days ago
I think using @testSetup method in the test class could also be a good option.
upvoted 0 times
...
Janey
13 days ago
But wouldn't it be better to have a separate TestDataFactory for the setup?
upvoted 0 times
...
Kimbery
29 days ago
I agree, turning off triggers, flows, and validations seems like the quickest solution.
upvoted 0 times
...
...
Teresita
2 months ago
I'm going to have to go with Option B. Creating a TestDataFactory and calling it from each test method seems more modular and reusable than the other options.
upvoted 0 times
Jenelle
21 days ago
And it would also make it easier to update the setup for the prerequisite reference data in the future.
upvoted 0 times
...
Ines
22 days ago
It would definitely help in keeping the test class clean and organized.
upvoted 0 times
...
Daron
30 days ago
I agree, having a TestDataFactory would make it easier to manage the setup for the test data.
upvoted 0 times
...
Renea
1 months ago
Option B sounds like a good idea. It would definitely make the tests more modular.
upvoted 0 times
...
...
Casandra
2 months ago
I personally prefer option A. Turning off triggers, flows, and validations can significantly speed up the tests.
upvoted 0 times
...
Chantay
2 months ago
Option C seems like the best solution. Setting up the prerequisite data in a @testSetup method will ensure it's only run once before the tests, rather than in each individual test method.
upvoted 0 times
Refugia
21 days ago
D: I think I'll try implementing @testSetup in my test class to see if it helps speed up the unit tests.
upvoted 0 times
...
Billi
1 months ago
C: I agree. It's important to optimize the test setup for better performance.
upvoted 0 times
...
Carlton
2 months ago
B: That's a good point. It can definitely help improve the speed of the unit tests.
upvoted 0 times
...
Tasia
2 months ago
A: Option C seems like the best solution. Setting up the prerequisite data in a @testSetup method will ensure it's only run once before the tests, rather than in each individual test method.
upvoted 0 times
...
...
Brandon
2 months ago
I disagree, I believe option C is the way to go. It will help keep the setup organized and separate from the test methods.
upvoted 0 times
...
Natalya
2 months ago
I think option B is the best choice. It will make the tests faster and more efficient.
upvoted 0 times
...

Save Cancel