어느 Salesforce Developer의 개발 성장기

[Salesforce Certified Platform Developer1] Dump 오답 일기11 본문

Salesforce Dump/Platform Developer1 Dump

[Salesforce Certified Platform Developer1] Dump 오답 일기11

Developer_Foryou 2020. 3. 8. 01:04

※ 각 자격증별 Dump는 시험을 준비하면서, 
웹상에 공개된 Dump와 유료 Dump를 풀면서 자주 틀렸던 문제를 위주로 작성하였습니다. 
오래된 문제도 간혹 있기 때문에 버전에 따라 답이 다른 경우도 있으며,
개인이 공부하면서 푼 문제이기 때문에 오답일 가능성도 있습니다.
이점 유의하여 공부하시길 바랍니다.

 

While writing a test class that covers an OpportunityLineItem trigger, a Developer is unable to create a standard PriceBook since one already exists in the org. How should the Developer overcome this problem?

A. Use Test.getStandardPricebookId() to get the standard PriceBook ID.
B. Use @IsTest(SeeAllData=true) and delete the existing standard PriceBook.
C. Use Test.loadData() and a Static Resource to load a standard Pricebook.
D. Use @TestVisible to allow the test method to see the standard PriceBook.

Answer A

Which approach should be used to provide test data for a test class?

A. Query for existing records in the database.
B. Execute anonymous code blocks that create data.
C. Use a test data factory class to create test data.
D. Access data in @TestVisible class variables.

Answer C

A newly hired developer discovers that there are multiple triggers on the case object. What should the developer consider when working with triggers?

A. Developers must dictate the order of trigger execution.
B. Trigger execution order is based on creation date and time.
C. Unit tests must specify the trigger being tested.
D. Trigger execution order is not guaranteed for the same sObject.

Answer D

Using the Schema Builder, a developer tries to change the API name of a field that is referenced in an Apex test class. What is the end result?

A. The API name is not changed and there are no other impacts.
B. The API name of the field and the reference in the test class is changed.
C. The API name of the field is changed, and a warning is issued to update the class.
D. The API name of the field and the reference in the test class is updated.

Answer C → A

A Developer needs to test an invoincing system integration. after reviewing the number of transactions required for the test, the developer estimates that the test data will total about 2gb of data storage. production data is not required for the integration testing. which two environments meet the requirements for testing? (choose two)

A. Developer Sandbox
B. Full Sandbox
C. Developer Edition
D. Partial Sandbox
E. Developer Pro Sandbox

Answer B, D

A developer creates an Apex class that includes private methods. What can the developer do to ensure that the private methods can be accessed by the test class?

A. Add the TestVisble attribute to the Apex class
B. Add the SeeAllData attribute to the test methods.
C. Add the TestVisible attribute to the apex methods.
D. Add the SeeAllData attribute to the test class

Answer C

Considerations for the @IsTest(SeeAllData=true) Annotation

  • If a test class is defined with the @isTest(SeeAllData=true) annotation, the annotation applies to all its test methods whether the test methods are defined with the @isTest annotation or the (deprecated) testMethod keyword.
  • The @isTest(SeeAllData=true) annotation is used to open up data access when applied at the class or method level. However, if the containing class has been annotated with @isTest(SeeAllData=true), annotating a method with @isTest(SeeAllData=false) is ignored for that method. In this case, that method still has access to all the data in the organization. Annotating a method with @isTest(SeeAllData=true) overrides, for that method, an @isTest(SeeAllData=false) annotation on the class.
  • @isTest(SeeAllData=true) and @isTest(isParallel=true) annotations cannot be used together on the same Apex method.

 

What is the proper process for an Apex Unit Test?

A. Query for test data using SeeAllData = true. Call the method being tested. Verify that the results are correct.
B. Query for test data using SeeAllData = true. Execute runAllTests(). Verify that the results are correct.
C. Create data for testing. Execute runAllTests(). Verify that the results are correct.
D. Create data for testing. Call the method being tested. Verify that the results are correct.

Answer D

 

Which type of controller should a developer use to include a list of related records for a Custom Object record on a Visualforce page without needing additional test coverage?

A. List Controller
B. Standard Controller ( Ans )
C. Controller Extension
D. Custom Controller

 

What are three ways for a developer to execute tests in an org? Choose 3 answers

A. Tooling API ( Ans )
B. Setup Menu ( Ans )
C. Developer Console ( Ans )
D. Bulk API
E. Metadata API

A developer is creating test coverage for a class and needs to insert records to validate functionality. Which method annotation should be used to create records for every method in the test class?

A. @isTest(SeeAllDate=true)
B. @PreTest
C. @TestSetup ( Ans )
D. @BeforeTest

Comments