ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 31 - AD0-E718 discussion

Report
Export

An Architect wants to create an Integration Test that does the following:

• Adds a product using a data fixture

• Executes $this->someLogic->execute($product) on the product

• Checks if the result is true.

Sthis->someLogic has the correct object assigned in the setup () method-Product creation and the tested logic must be executed in the context of two different store views with IDs of 3 and 4, which have been created and are available for the test.

How should the Architect meet these requirements?

A.
Create one test class with one test method. Use the \Magento\testFramework\ store\Executionstorecontext class once in the fixture and another time in the test.
Answers
A.
Create one test class with one test method. Use the \Magento\testFramework\ store\Executionstorecontext class once in the fixture and another time in the test.
B.
Create two test Classes With one test method each. Use the @magentoExecuteInStoreContext 3 and @magentoExecuteInStoreContext 4 annotations on the class level.
Answers
B.
Create two test Classes With one test method each. Use the @magentoExecuteInStoreContext 3 and @magentoExecuteInStoreContext 4 annotations on the class level.
C.
Create one test class with two test methods. Use the @magentoStoreContext 3 annotation in one method and @magentoStoreContext 4 in the other one.
Answers
C.
Create one test class with two test methods. Use the @magentoStoreContext 3 annotation in one method and @magentoStoreContext 4 in the other one.
Suggested answer: B

Explanation:

The best approach for the Architect to meet the requirements is Option B. Create two test Classes With one test method each. Use the @magentoExecuteInStoreContext 3 and @magentoExecuteInStoreContext 4 annotations on the class level. This will ensure that the fixture is executed in the context of Store View 3, and the tested logic is executed in the context of Store View 4. This approach allows for more granular control of the store views and reduces the complexity of the test.

asked 02/10/2024
Akash Makkar
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first