After Xamarin was acquired by Microsoft, it became a natural expectations from the Xamarin developers and testers to have the scripting support available from inside the visual studio environment. This article will explain you about how to setup visual studio with required SDK and tools and how to write your first script and upload it on test cloud.
2.Before we start!
- Operating Systems – Windows 7 or OS X 11.0,12.0
- 1.6 GHz or faster processor
- 1 GB of RAM (1.5 GB if running on a virtual machine)
- 4 GB of available hard disk space
- 5400 RPM hard drive
- Download visual studio from here: https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx
Download Visual studio community version and then follow the following steps.
- Double click the downloaded file and Click on the “Run” button.
- After Clicking on the run button, a pop up will prompt on the screen. Select the “Custom” option and click on the “Next” button.
- Once you click on the “Custom” button you will land to this page.
4.Complete visual studio Installation Instructions:
To complete the installation process we would require certain tools as listed below:
- Common Tools for Visual C++ 2015.
- Microsoft Sql Server Data Tools
- Microsoft Web Developer Tools.
- Windows 10 SDK(10.0.10586)
- Visual C++ Mobile Development
- Android Native Development Kit(R11C,64 Bits)[3rd Party]
- Apache Ant(1.9.3)[3rd Party]
In order to complete the installation of visual studio, please follow the steps mentioned below:
- To install, expand Programming Languages and select “Visual C++”. Under Visual C++ select “Common Tools for Visual C++ 2015” and click on the “Next” button.
- To install “Microsoft SQL Server Data Tools” & “Microsoft Web Developer Tools” Expand “Windows and Web Development” tree and select “Microsoft SQL Server Data Tools” & “Microsoft Web Developer Tools” and Click on “Next”.
- To install “Windows 10 SDK (10.0.10586)” Expand the tree of “Universal Windows App Development Tools” and select “Windows 10 SDK(10.0.10586)” and Click on “Next”.
- To install “Visual C++ Mobile Development”, expand the tree for “Cross Platform Mobile Development” and select “Visual C++ Mobile Development” and then it will automatically select “Android Native Development Kit (R11C,64 bits) 3rd Party”, “Apache Ant(1.9.3)3rdParty” to complete the installation of these tools click on “Next”.
- Click on “Install” to complete the Process.
6.Create a Test Project
1.Open Visual studio.
2.Click on “File” and add a new “Project”.
3.Select “Test” from the left panel and from the right pane select “UI Test App(Xamarin.UITEST|Android)”.
4.Enter the name of the project .
5.In the SETUP section enter the path of the apk file.
7.Create Test Script (for example, script for Login)
public class Tests
public void BeforeEachTest()
// TODO: If the Android app being tested is included in the solution then open
// the Unit Tests window, right click Test Apps, select Add App Project
// and select the app projects that should be tested.
app = ConfigureApp.Androi.ApkFile(@"PASTE YOUR APK FILE PATH HERE").StartApp();
//THis will launch the application.
public void AppLaunches()
// app.Repl(); //It allows a user to interact with the object hierarchy.
app.EnterText(x => x.Marked("input_userName"), ""); //It will enter the username in the username field.
app.EnterText(x => x.Marked("input_password"), "Rajit"); //it will enter the password in the password field.
app.Tap(x => x.Marked("loginBtn")); //Tap on the login field.
8.Build Test Project in the Release Mode
a.Select the mode as “Release”.
b.Click on Build from the main toolbar and select “Build Solution”.
9.Upload the Script on Test Cloud
a.Sign Up at : https://testcloud.xamarin.com/
b.Click on “New Test Run” on the header bar
c.Select the platform(Android/IOS) and click on “Next”.
d.Select the specification (OS version, Manufacturer, Memory, Device family, Processor) from the left panel, select the device from the centre and Click on the Select x device button in the bottom.
e.You can run your script in series if you want to maintain otherwise keep the master series selected and click on next.
e.On this final step you can select following things:
- Select the language of the script (C# or Ruby)
- Platform of your system where the script is written
- And copy the generated command
packages\Xamarin.UITest.[version]\tools\test-cloud.exe submit yourAppFile.apk ff2d3a610f6b0e01460446fbf22a48e1 –devices bbb58a62 –series “master” –locale “en_US” –user firstname.lastname@example.org –assembly-dir pathToTestDllFolder
Note: At the end paste the folder path where the Dll files are placed.
The complete command should look like this:
test-cloud.exe submit com.walkingtree.Sales360.Droid-Signed.apk 8889f97cfeeb047204a5fb0df65f321d –devices bbb58a62 –series “master” –locale “en_US” –app-name “Sales 360” –user email@example.com –assembly-dir “D:\Src\Sales360\Sales360\Sales360.Droid\AppLaunch\AppLaunch\bin\Release”
- Click on Done.
10.Steps to follow in your local system to upload script:
a.Open CMD in your local machine.
b.Type Cd and press “Enter”.
c.Type “d:” and press “Enter”(Reach out the drive where your script is placed in your system).
d.Reach the testcloud.exe file inside packages folder.
For me it was:
Copy that path and type cd D:\Src\Sales360\Sales360\Sales360.Droid\AppLaunch\packages\Xamarin.UITest.1.0.0\tools and press “Enter”
e.Now enter the command we copied from test cloud and press “Enter”:
test-cloud.exe submit com.walkingtree.Sales360.Droid-Signed.apk 8889f97cfeeb047204a5fb0df65f321d –devices bbb58a62 –series “master” –locale “en_US” –app-name “Sales 360” –user firstname.lastname@example.org –assembly-dir “D:\Src\Sales360\Sales360\Sales360.Droid\AppLaunch\AppLaunch\bin\Release”
Once it is done the command prompt will look like this:
In this article, I explained how the visual studio can be configured to setup the Xamarin Test Cloud Environment on a given machine. Often the test automation falls under QA team and they do face challenges with the initial setup of the Xamarin Test Cloud environment. I hope this blog will help you in getting started with Xamarin Test Cloud without much fuss.
At WalkingTree we encourage our customers to have the test automation in place. Xamarin Test Cloud has been a big savior for us and we do recommend our customers to utilize this.