Request Quote

How to Attach a File in Magento Functional Testing Framework (MFTF)

Magento has been introduced their inbuild automation framework. Which is based on Codeception. It’s really useful for both QA and Developer for the acceptance Testing.

The process of using attachments is very simple. Here I’ll give you an example of adding an image. I have used it to automate one of our modules. Where in the backend I need to add an image.

First, you need to go inside your MagentoRoot/dev/tests/acceptance/tests/_data and upload an image name 1.jpeg. You can upload the image/file of whatever name or extension you want to use. I have used 1.jpeg just for an example.

Now I’ll explain you the code I have Written related to it.

Code which is written in ModuleSection.xml File-

<element name="labelImage" type="file" selector="#shippinglabel_filename"/>

Code which is written in ModuleData.xml File-

<data key="label_image">1.jpeg</data>

Code which is written in ModuleActionGroup.xml or you can write it directly in ModuleTest.xml file-

<attachFile userInput="{{AdminRmaShippingLabelData.label_image}}" selector="{{AdminRmaShippingLabelCreateSection.labelImage}}" stepKey="fillLabeluploadImage"/>

Use <attachFile/> node to attach a file/image.

Here,

AdminRmaShippingLabelData is the entity name of ModuleData.xml file.

AdminRmaShippingLabelCreateSection is the section name of ModuleSection.xml file.

In case of any doubt please leave a message here.

Thanks! 🙂

. . .

Comment

Add Your Comment

Be the first to comment.

css.php