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 3 Discussion

Actual exam question for Salesforce's Salesforce Certified Platform Developer II (Plat-Dev-301) exam
Question #: 3
Topic #: 7
[All Salesforce Certified Platform Developer II (Plat-Dev-301) Questions]

An Apex class does not achieve expected code coverage. The testSetup method explicitly calls a method in the Apex class. How can the developer generate the code coverage?

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

0/2000 characters
Sharmaine
4 months ago
Permissions shouldn't affect code coverage, right?
upvoted 0 times
...
Gail
4 months ago
Wait, can you really get coverage just from testSetup? Seems off.
upvoted 0 times
...
Alonso
4 months ago
Definitely agree with option C, that's how you get the coverage!
upvoted 0 times
...
Corinne
4 months ago
@testVisible won't help if the method isn't called in the right context.
upvoted 0 times
...
Earlean
4 months ago
I think calling the method from a testMethod is the way to go.
upvoted 0 times
...
Kris
5 months ago
I vaguely recall that permissions can affect code execution, but I don't think that's the main issue here. It seems more about how we structure the tests.
upvoted 0 times
...
Afton
5 months ago
I feel like using system.assert() in testSetup could help, but I’m not entirely convinced it would improve coverage.
upvoted 0 times
...
Janessa
5 months ago
I think calling the method in a testMethod might be necessary to actually hit the code paths we need. That sounds familiar from practice questions.
upvoted 0 times
...
Ammie
5 months ago
I remember discussing how @testVisible can help with visibility in tests, but I'm not sure if that's the right approach for code coverage.
upvoted 0 times
...
Wilda
5 months ago
Okay, let's see. The organization has defined its goals, analyzed its internal strengths and weaknesses, and done a corporate appraisal. I think the key here is to identify the external analysis stage that's likely missing.
upvoted 0 times
...
Gerald
5 months ago
This seems like a tricky one. I'll need to think carefully about the different options and how they might apply to the scenario.
upvoted 0 times
...
Lonny
5 months ago
I'm a little unsure about this one. The question is asking about the auditor's responsibilities, but the options seem to be comparing the Yellow Book to GAAS audits. I'll need to review the differences between the two standards to make sure I understand the implications for the auditor's work.
upvoted 0 times
...
Sandip Mondal
2 years ago
For code coverage, method of a class should be invoked from a testMethod instead of testSetup. testSetup is used to setup test data in a test class
upvoted 1 times
Sandip Mondal
2 years ago
Answer here should be C
upvoted 1 times
Mike Kang
2 years ago
No, Sandip, you're wrong. When an Apex class is invoked in testsetup, it increases coverage. Though I agree that a function which needs to be tested should be invoked from a @IsTest method.. anyway C doesn't matter.
upvoted 1 times
...
...
...

Save Cancel