nerdexam
Adobe

AD0-E716 · Question #11

An Adobe Commerce developer is writing an integration test. They checked some Integration Tests for Magento core modules for reference and noticed that they use data fixtures initialized by adding…

The correct answer is B. Option B. To add a custom fixture to test a MyVendor_MyModule, the developer needs to do the following: Create a PHP file with the fixture data in [magento root dir]/dev/tests/integration/testsuite/MyVendor/MyModule/_files/my_fixture.php. Add the following annotation to the test method…

Customization

Question

An Adobe Commerce developer is writing an integration test. They checked some Integration Tests for Magento core modules for reference and noticed that they use data fixtures initialized by adding annotations to test classes. For example: The developer wants to add their own fixture to test a MyVendor_MyModule they created. Which steps will make this possible? A. 1. Create a PHP file with the fixture data inside their own module in [module dir]/Test/integration/_fiies/my_fixture.php. 2. Add the following annotation to the test method: B. 1. Create a PHP file With the fixture data in [magento root dir]/dev/tests/integration/testsuite/MyVendor/MyModule/_files/my_fixture.php. 2. Add the following annotation to the test method: C. 1. Create a PHP file with the fixture data inside their own module in [module dir]/Test/integration/_f iies/my_f ixture.php. 2. Add the following annotation to the test method:

Options

  • AOption A
  • BOption B
  • COption C

How the community answered

(22 responses)
  • A
    9% (2)
  • B
    77% (17)
  • C
    14% (3)

Explanation

To add a custom fixture to test a MyVendor_MyModule, the developer needs to do the following: Create a PHP file with the fixture data in [magento root dir]/dev/tests/integration/testsuite/MyVendor/MyModule/_files/my_fixture.php. Add the following annotation to the test method: @magentoDataFixture( 'testsuite/MyVendor/MyModule/_files/my_fixture.php' This will tell Magento to load the fixture data from the my_fixture.php file before the test method is

Topics

#integration tests#data fixtures#test annotations#module testing

Community Discussion

No community discussion yet for this question.

Full AD0-E716 Practice