Test Automation with Xamarin Test Cloud for Mobile App Development
Automation testing for mobile applications can be very useful in many situations. For example, when we are going to test some features several times or when we have a very large project or even when we want to do a more interesting job and let to the computer doing the 'boring tasks’.
With this in mind we can evaluate some tools available to make the automation process easier. In this post we are going to talk briefly about a new tool that makes automation testing possible for mobile app development even if you don’t have a whole lot of technical knowledge about mobile development itself.
When you have to test an Android or iOS mobile application, it could be very helpful to automate some tests in order to reduce time, effort and human error. There is a new tool called Xamarin Test Cloud, where you can write your test scripts and run it on various devices at same time on the cloud and have a visual description of every step that is executed
Get Started With the Scripts
After you have defined all the tests that you want to automate, you can start writing your scripts. For this purpose we have the ability to use “Calabash” that is an automated testing technology for Native Android, iOS and hybrid mobile applications.
Calabash supports “Cucumber”. Cucumber lets us express the behavior of our app using natural language that can be understood by business experts and non-technical QA staff.
Calabash consists of libraries that enable test-code to programmatically interact with native and hybrid mobile apps. The interaction consists of a number of end-user actions. Each action can be one of the following:
Touches or gestures (e.g., tap, swipe and rotate).
For example: there should be a "Login" button or the web view should contain an "<h1>" element with the text "Hello".
Screendump the current view on the current device model
An example of a cucumber script could be the following:
We can see that the syntax is very similar to natural language expressed as a set of steps. We can use the labels of the objects with what we want to interact with instead of ambiguous names or codes.
After have written our script, we need to save it as a “.feature” file to be able to upload and run our test on the test cloud.
Calabash is also used for testing your scripts either with an emulator or a physical device.
Before we can run our test scripts, we need to make sure that we have installed all the prerequisites to use calabash and these prerequisites are: “the latest version of Ruby” and “calabash-ios” or “calabash-android”.
You can find detailed instructions about how to install calabash in the following link https://github.com/calabash
Once we have our scripts, it can be executed easily through “Xamarin Test Cloud” with a few steps. We need to select “New Test Run” followed by “Use my Calabash test scripts”
Then we need to select on which devices we want to run our scripts and finally run the command provided by test cloud.
test-cloud submit your_app_filename 9330fe1eecc71d8e3bb81f1d4ab03a37 -d 2a8ea854
Now our tests are running and Test Cloud will send us an email when tests have been finalized.
Our tests results will be shown in a very simple way which can be shared with any person involved in the project we are testing.
Just like that you have some scripts tested! I personally think that is an amazing tool and hope that you found this information useful.
Although this is a very brief guide, it can help you to know the tool and increase your knowledge about the vast number of tools that you can use and if it is useful for your project. If you have any comment please share it with us.
About the Author
Ruben Ortega is a Computer System engineer with 2+ years of experience. He likes to design automated tests for different kinds of software. He has a passion about scripting in python and any other scripting language.