{"id":34088,"date":"2016-05-02T11:43:15","date_gmt":"2016-05-02T06:13:15","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=34088"},"modified":"2016-06-13T10:39:49","modified_gmt":"2016-06-13T05:09:49","slug":"android-app-automation-on-multiple-devices-in-parellel-using-aws-device-farm","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/android-app-automation-on-multiple-devices-in-parellel-using-aws-device-farm\/","title":{"rendered":"Android App Automation on Multiple Devices in parallel using AWS Device Farm"},"content":{"rendered":"<p>App Automation lets you ensure that you can run your test-suite repetitively, with minimal effort &amp; check the results whether its meeting your functional requirements or not. After each build-release, you need to follow the same procedure. But the challenge is to cover variety of phones &amp; tablets and it is really impossible to test all mobile devices.<\/p>\n<p>The solution is here, AWS introduce its\u00a0<a title=\"AWS Device Farm Home Page\" href=\"https:\/\/aws.amazon.com\/device-farm\/\" target=\"_blank\"><strong>Device Farm<\/strong><\/a>\u00a0which offers you 250+ devices on iOS, Android &amp; Fire OS platform.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-34090 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/Amazon-Web-Services-Device-Farm.jpg\" alt=\"SameCodeforMultipleDevices\" width=\"650\" height=\"286\" \/><\/p>\n<h1><strong>How to use Device Farm to test an Android app?<\/strong><\/h1>\n<p>The answer is in three\u00a0simple steps:<\/p>\n<h3><strong>Step 1) Sign in to the Console<\/strong><\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-34093 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/SignIn.png\" alt=\"SignIn\" width=\"408\" height=\"414\" \/><\/p>\n<h3><strong><br \/>\nStep 2) Create a Project<\/strong><\/h3>\n<p>Click this button, type your Project name &amp; choose Create Project.<\/p>\n<h4><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-34091\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/CreateProject.png\" alt=\"CreateProject\" width=\"624\" height=\"612\" \/><\/h4>\n<h3>Step 3) Upload the build and Start a Run<\/h3>\n<p>After creating a project, go for <strong>Create a new run<\/strong>. Here you can run your set of tests, just you need to give an .apk file &amp; your test scripts.<\/p>\n<p>i) On <strong>Choose application page<\/strong>, under native application option, <strong>Upload<\/strong> an .apk file. After success upload, you can edit the Run name.<\/p>\n<p><strong>Go for Next step<\/strong><\/p>\n<p>ii) On the <strong>Configure test page<\/strong>, choose <strong>Appium Java TestNG<\/strong> as test suite and <strong>Upload<\/strong> your <strong>dependency-zip<\/strong> file. (to know: how to create dependency\u00a0file, refer this\u00a0blog <a title=\"TestCases in a .zip File\" href=\"http:\/\/www.tothenew.com\/blog\/how-to-provide-your-testsscripts-dependencies-to-aws-device-farm\/\" target=\"_blank\">How to provide your TestsScripts &amp; Dependencies to AWS Device Farm<\/a>)<\/p>\n<p><strong>Go for Next step<\/strong><\/p>\n<p>iii) On <strong>Select Device page<\/strong>, choose <strong>Top Devices<\/strong> to select the device pool, and then choose Next step. You can choose Curated pools option as well, if you have already selected the devices from the device collection.<\/p>\n<p>iv) On the Specify device state page, you can do any of the following:<\/p>\n<p style=\"padding-left: 30px\">&#8211; To provide additional data while running your tests<br \/>\n&#8211; To install an additional app(another .apk file) which you&#8217;ll require as supporting app for one of your test,<br \/>\n&#8211; To specify whether Wi-Fi, Bluetooth, GPS, or NFC will be enabled during the run,<br \/>\n&#8211; You can give the coordinates of device latitude and longitude for the run,<br \/>\n&#8211; You can choose the locale also.<\/p>\n<p>v) Now reconfirm your settings &amp; choose <strong>Start run<\/strong>.<\/p>\n<h3>Once the test cases will complete then you&#8217;ll be able to view the Run&#8217;s Results.<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-34132\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/04\/Result-Page.png\" alt=\"Result-Page\" width=\"1200\" height=\"942\" \/><\/p>\n<p>After completing the test-run, just click on your run, then you&#8217;ll see that your test-cases have executed on all those devices which you selected from device-pool.<\/p>\n<p>On Test-Run detail page, there is another tab i.e. &#8216;<strong>Screenshots<\/strong>&#8216;, which will display a list of all screenshots captured during your test &amp; for capturing the screenshots during the test, you need to mention a small code in your test-script. &amp; Your answer is here:<\/p>\n<h3>How to take Screenshots in Native &amp; Web Application<\/h3>\n<p>[java]<br \/>\npublic boolean captureScreenshot(final String name) {<br \/>\nString directory = System.getProperty(&quot;appium.screenshots.dir&quot;, System.getProperty(&quot;java.io.tmpdir&quot;, &quot;&quot;));<br \/>\nFile screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);<br \/>\nreturn screenshot.renameTo(new File(screenshotDirectory, String.format(&quot;%s.png&quot;, name)));<br \/>\n}<br \/>\n[\/java]<\/p>\n<p>You can also handle your Test-Runs from Jenkins, just integrate your git repository with Jenkins using <a title=\"Jenkins CI Plugin\" href=\"http:\/\/docs.aws.amazon.com\/devicefarm\/latest\/developerguide\/continuous-integration-jenkins-plugin.html\" target=\"_blank\">Jenkins CI Plugin<\/a>.<\/p>\n<p>I hope this will ease your Mobile App Automation \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>App Automation lets you ensure that you can run your test-suite repetitively, with minimal effort &amp; check the results whether its meeting your functional requirements or not. After each build-release, you need to follow the same procedure. But the challenge is to cover variety of phones &amp; tablets and it is really impossible to test [&hellip;]<\/p>\n","protected":false},"author":201,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":11},"categories":[518,1818,1174,1400,446,1772,1,1816],"tags":[1978,3274,2943,1561],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34088"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/201"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=34088"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34088\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=34088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=34088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=34088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}