New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Certified Platform Developer II (Plat-Dev-301) Exam - Topic 7 Question 96 Discussion

Actual exam question for Salesforce's Salesforce Certified Platform Developer II (Plat-Dev-301) exam
Question #: 96
Topic #: 7
[All Salesforce Certified Platform Developer II (Plat-Dev-301) 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:

0/2000 characters
Ryan
3 months ago
@testSetup is faster for sure, saves a lot of time!
upvoted 0 times
...
Alex
3 months ago
Turning off triggers can help, but it's not a long-term fix.
upvoted 0 times
...
Kaitlyn
4 months ago
Surprised that people still use constructors for setup!
upvoted 0 times
...
Sarina
4 months ago
I disagree, using a TestDataFactory is more flexible.
upvoted 0 times
...
Rima
4 months ago
@testSetup method is definitely the way to go!
upvoted 0 times
...
Frank
4 months ago
I feel like using the constructor for setup could be risky; it might lead to issues if the tests depend on specific data states.
upvoted 0 times
...
Elden
5 months ago
I practiced a similar question where moving setup to a TestDataFactory helped with performance, but I wonder if @testSetup is better.
upvoted 0 times
...
Annett
5 months ago
I'm not entirely sure, but I think turning off triggers and validations might not be the best practice for tests.
upvoted 0 times
...
Malcom
5 months ago
I remember discussing the use of @testSetup methods in class; it seems like a good way to reduce redundancy.
upvoted 0 times
...
Deonna
5 months ago
I'm leaning towards option D. Putting the setup in the constructor seems like it could be a good way to ensure the data is available for all the tests in the class.
upvoted 0 times
...
Donette
5 months ago
Option C looks promising to me. Moving the setup to a @testSetup method could help keep the individual test methods clean and focused.
upvoted 0 times
...
Bette
5 months ago
Hmm, I'm a bit confused. I'm not sure if turning off triggers, flows, and validations is the best idea, as that could impact the accuracy of the tests. Maybe I should re-read the question and options more carefully.
upvoted 0 times
...
Kattie
5 months ago
This seems like a straightforward question. I think option B is the best approach - using a TestDataFactory to set up the prerequisite reference data.
upvoted 0 times
...
Edison
5 months ago
Okay, I've got this. Pods can run one or more containers, so option B is definitely true. And Pods are the smallest execution unit in Kubernetes, so option D is also true. I'll select those two.
upvoted 0 times
...
Kristel
5 months ago
Hmm, I'm a bit unsure about this one. I know configuration management is important for operations, but I'm not sure which of these options is the best explanation.
upvoted 0 times
...
Jess
5 months ago
This looks like a data modeling question. I think the key is to create a date table and establish relationships to the relevant date columns in the Orders table.
upvoted 0 times
...
Anastacia
10 months 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
Jacklyn
8 months ago
C) Move the prerequisite reference data setup to a @testSetup method in the test class.
upvoted 0 times
...
Malcolm
8 months ago
B) Move the prerequisite reference data setup to a TestDataFactory and call that from each test method.
upvoted 0 times
...
Mauricio
9 months ago
A) Turn off triggers, flows, and validations when running tests.
upvoted 0 times
...
...
Theresia
10 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
9 months ago
C) Move the prerequisite reference data setup to a @testSetup method in the test class.
upvoted 0 times
...
Mendy
9 months ago
B) Move the prerequisite reference data setup to a TestDataFactory and call that from each test method.
upvoted 0 times
...
Janae
9 months ago
A) Turn off triggers, flows, and validations when running tests.
upvoted 0 times
...
...
Julianna
10 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
9 months ago
I think using @testSetup method in the test class could also be a good option.
upvoted 0 times
...
Janey
9 months ago
But wouldn't it be better to have a separate TestDataFactory for the setup?
upvoted 0 times
...
Kimbery
10 months ago
I agree, turning off triggers, flows, and validations seems like the quickest solution.
upvoted 0 times
...
...
Teresita
11 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
9 months ago
And it would also make it easier to update the setup for the prerequisite reference data in the future.
upvoted 0 times
...
Ines
9 months ago
It would definitely help in keeping the test class clean and organized.
upvoted 0 times
...
Daron
10 months ago
I agree, having a TestDataFactory would make it easier to manage the setup for the test data.
upvoted 0 times
...
Renea
10 months ago
Option B sounds like a good idea. It would definitely make the tests more modular.
upvoted 0 times
...
...
Casandra
11 months ago
I personally prefer option A. Turning off triggers, flows, and validations can significantly speed up the tests.
upvoted 0 times
...
Chantay
11 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
9 months 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
10 months ago
C: I agree. It's important to optimize the test setup for better performance.
upvoted 0 times
...
Carlton
10 months ago
B: That's a good point. It can definitely help improve the speed of the unit tests.
upvoted 0 times
...
Tasia
11 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
11 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
11 months ago
I think option B is the best choice. It will make the tests faster and more efficient.
upvoted 0 times
...

Save Cancel