{"id":149640,"date":"2018-10-29T15:21:19","date_gmt":"2018-10-29T15:21:19","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=149640"},"modified":"2018-11-02T07:54:31","modified_gmt":"2018-11-02T07:54:31","slug":"how-to-attach-file-magento-functional-testing-framework-mftf","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/","title":{"rendered":"How to Attach a File in Magento Functional Testing Framework (MFTF)"},"content":{"rendered":"<p>Magento has been introduced their inbuild automation framework. Which is based on Codeception. It&#8217;s really useful for both QA and Developer for the acceptance Testing.<\/p>\n<p>The process of using attachments is very simple. Here I&#8217;ll\u00a0give 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.<\/p>\n<p>First, you need to go inside your <strong>MagentoRoot\/dev\/tests\/acceptance\/tests\/_data<\/strong> 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.<\/p>\n<p><a href=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-149648\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png\" alt=\"\" width=\"704\" height=\"402\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png 704w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1-250x143.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1-300x171.png 300w\" sizes=\"(max-width: 704px) 100vw, 704px\" loading=\"lazy\" \/><\/a><\/p>\n<p>Now I&#8217;ll explain you the code I have Written related to it.<\/p>\n<p>Code\u00a0which is written in <strong>ModuleSection.xml<\/strong> File-<\/p>\n<pre class=\"brush:xml\">&lt;element name=\"labelImage\" type=\"file\" selector=\"#shippinglabel_filename\"\/&gt;<\/pre>\n<p>Code which is\u00a0written in <strong>ModuleData.xml<\/strong> File-<\/p>\n<pre class=\"brush:xml\">&lt;data key=\"label_image\"&gt;1.jpeg&lt;\/data&gt;<\/pre>\n<p>Code which is written in <strong>ModuleActionGroup.xml<\/strong> or you can write it directly in\u00a0<strong>ModuleTest.xml<\/strong> file-<\/p>\n<pre class=\"brush:xml\">&lt;attachFile userInput=\"{{AdminRmaShippingLabelData.label_image}}\" selector=\"{{AdminRmaShippingLabelCreateSection.labelImage}}\" stepKey=\"fillLabeluploadImage\"\/&gt;<\/pre>\n<p>Use <strong>&lt;attachFile\/&gt;<\/strong> node to attach a file\/image.<\/p>\n<p>Here,<\/p>\n<p><em>AdminRmaShippingLabelData<\/em> is the entity name of\u00a0<strong>ModuleData.xml <\/strong>file<strong>.<\/strong><\/p>\n<p><em>AdminRmaShippingLabelCreateSection<\/em> is the section name of\u00a0<strong>ModuleSection.xml <\/strong>file.<\/p>\n<p>In case of any doubt please leave a message here.<\/p>\n<p>Thanks! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento has been introduced their inbuild automation framework. Which is based on Codeception. It&#8217;s really useful for both QA and Developer for the acceptance Testing. The process of using attachments is very simple. Here I&#8217;ll\u00a0give you an example of adding an image. I have used it to automate one of our modules. Where in the <a href=\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":66,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302],"tags":[3885,3888,7724,7252,7272,7060],"class_list":["post-149640","post","type-post","status-publish","format-standard","hentry","category-magento2","tag-attachment","tag-file-upload","tag-image-upload","tag-m2","tag-magento-functional-testing-framework","tag-mftf"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Attach a File in Magento Functional Testing Framework (MFTF) - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Attach a File in Magento Functional Testing Framework (MFTF) - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Magento has been introduced their inbuild automation framework. Which is based on Codeception. It&#8217;s really useful for both QA and Developer for the acceptance Testing. The process of using attachments is very simple. Here I&#8217;ll\u00a0give you an example of adding an image. I have used it to automate one of our modules. Where in the [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-29T15:21:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-11-02T07:54:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png\" \/>\n<meta name=\"author\" content=\"Shruti Baranwal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shruti Baranwal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\"},\"author\":{\"name\":\"Shruti Baranwal\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/d90db6dde51254f8d7bda2539b81386e\"},\"headline\":\"How to Attach a File in Magento Functional Testing Framework (MFTF)\",\"datePublished\":\"2018-10-29T15:21:19+00:00\",\"dateModified\":\"2018-11-02T07:54:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\"},\"wordCount\":201,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png\",\"keywords\":[\"attachment\",\"file upload\",\"image upload\",\"m2\",\"magento functional testing framework\",\"mftf\"],\"articleSection\":[\"Magento2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\",\"name\":\"How to Attach a File in Magento Functional Testing Framework (MFTF) - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png\",\"datePublished\":\"2018-10-29T15:21:19+00:00\",\"dateModified\":\"2018-11-02T07:54:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage\",\"url\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png\",\"contentUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Attach a File in Magento Functional Testing Framework (MFTF)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/d90db6dde51254f8d7bda2539b81386e\",\"name\":\"Shruti Baranwal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2ecd6b094113b3e2f346229e04e90fcb6e242f28b3a1dbcb2f44fd9eefb93dbc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2ecd6b094113b3e2f346229e04e90fcb6e242f28b3a1dbcb2f44fd9eefb93dbc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Shruti Baranwal\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/shruti-baranwal890\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Attach a File in Magento Functional Testing Framework (MFTF) - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/","og_locale":"en_US","og_type":"article","og_title":"How to Attach a File in Magento Functional Testing Framework (MFTF) - Webkul Blog","og_description":"Magento has been introduced their inbuild automation framework. Which is based on Codeception. It&#8217;s really useful for both QA and Developer for the acceptance Testing. The process of using attachments is very simple. Here I&#8217;ll\u00a0give you an example of adding an image. I have used it to automate one of our modules. Where in the [...]","og_url":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2018-10-29T15:21:19+00:00","article_modified_time":"2018-11-02T07:54:31+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png","type":"","width":"","height":""}],"author":"Shruti Baranwal","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Shruti Baranwal","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/"},"author":{"name":"Shruti Baranwal","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/d90db6dde51254f8d7bda2539b81386e"},"headline":"How to Attach a File in Magento Functional Testing Framework (MFTF)","datePublished":"2018-10-29T15:21:19+00:00","dateModified":"2018-11-02T07:54:31+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/"},"wordCount":201,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png","keywords":["attachment","file upload","image upload","m2","magento functional testing framework","mftf"],"articleSection":["Magento2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/","url":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/","name":"How to Attach a File in Magento Functional Testing Framework (MFTF) - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png","datePublished":"2018-10-29T15:21:19+00:00","dateModified":"2018-11-02T07:54:31+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#primaryimage","url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png","contentUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2018\/10\/MftfFile1.png"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-attach-file-magento-functional-testing-framework-mftf\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Attach a File in Magento Functional Testing Framework (MFTF)"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/d90db6dde51254f8d7bda2539b81386e","name":"Shruti Baranwal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2ecd6b094113b3e2f346229e04e90fcb6e242f28b3a1dbcb2f44fd9eefb93dbc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2ecd6b094113b3e2f346229e04e90fcb6e242f28b3a1dbcb2f44fd9eefb93dbc?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Shruti Baranwal"},"url":"https:\/\/webkul.com\/blog\/author\/shruti-baranwal890\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/149640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/66"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=149640"}],"version-history":[{"count":12,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/149640\/revisions"}],"predecessor-version":[{"id":150372,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/149640\/revisions\/150372"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=149640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=149640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=149640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}