exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 414 discussion

Actual exam question from Salesforce's CRT-450
Question #: 414
Topic #: 1
[All CRT-450 Questions]

A developer at AW Computing is tasked to create the supporting test class for a programmatic customization that leverages records stored within the custom object, Pricing_Structure__c. AW Computing has a complex pricing structure for each item on the store, spanning more than 500 records.

Which two approaches can the developer use to ensure Pricing_Structure__c records are available when the test class is executed? (Choose two.)

  • A. Use the Test.loadTest() method.
  • B. Use the @IsTest(SeeAllData=true) annotation.
  • C. Use a Test Data Factory class.
  • D. Use without sharing on the class declaration.
Show Suggested Answer Hide Answer
Suggested Answer: AC 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
9352c71
1 month, 2 weeks ago
Selected Answer: BC
B. Use the @IsTest(SeeAllData=true) annotation: This allows the test class to access existing data in the database, including Pricing_Structure__c records. However, it's generally recommended to avoid using this approach unless necessary, as it can lead to tests that are dependent on the current state of the database. C. Use a Test Data Factory class: This approach involves creating a separate class or method to generate and insert the necessary test data programmatically. This is a best practice as it ensures that tests are independent of the existing data in the database and can be run in any environment.
upvoted 1 times
...
SS1121
7 months, 2 weeks ago
Option A seems incorrect or it should be Test.loadData()
upvoted 3 times
9352c71
1 month, 2 weeks ago
Agree, it should be Test.loadData() to be a correct answer
upvoted 1 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago