Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts

Wednesday, April 22, 2015

Robotium : How to automate an Android Application using Record and playback approach

In our last post we see how to install Robotium on our Eclipse IDE. In this post we will explain on how to record an android application and playback the script.

Step 1 : Open Eclipse IDE. Before started recording we need to run the Android virtual device. Click on the Android Virtual device icon.

image

AVD manager window is displayed and start a device that is already configured. How to configure a Virtual device will be posted later in separate post. Select a device and click on Start button.

image

Launch Options window is displayed and click on Launch button.

image

Virtual device will start for Launching.

image

image

Now minimize the virtual device window, close AVD window and proceed for Robotium recording.

Step 2 : Go to File > New > Other

image

Step 3 : Click on Android – Robotium Recorder from New Window. Select New Robotium Test.

Step 4 : Click on Next button.

image 

Step 5 : A pop up dialog is displayed with the message “Please Select the root Java JDK folder”. This message is only displayed if JDK folder is not defined and configured. Click on OK button.

image

Step 6 : Java JDK window is displayed. Locate the JDK folder on the machine. Click Ok button.

image

Step 7 : Robotium Recorder window is displayed and select the apk file. In our case we have downloaded android calculator apk file from this location. Select the apk file and enter the project name. Click on Next button.

image

Step 8 : Click on New Robotium Test button.

image 

Step 9 : Recording Started. Wait for the application starts at Virtual device.

image

image

Step 10 : Go to Virtual device window and note that application will start on that window.

Step 11 : Enter 4 at First text box

Step 12 : Click on the second text box and enter 5 at second text box

Step 13 : Click on Multiply button.

Step 14 : Result will be displayed at Result text box.

Step 15 : In order to verify the result click on the Result text box. It will create an assert script.

image 

Step 16 : Note that steps are written at plain text and click on Stop recording button.

image

A window may appear and click on OK button.

image 

Step 17 : Click on Save button

image

Step 18 : A window is displayed to ask for Test Case name. Enter Test Case name as “Multiplication” and click on OK button.

image

Step 19 : Click on Finish button.

image

Step 20 : Code will be generated for this script at Eclipse editor. Expand the project of the package explorer window.

image

Step 21 : Double click on the class name “Multiplication.java”. We see the step by step script on the code. We will explain about code on future post.

image 

Step 22 : Now Run the script. Right click on the Script name and click Run as > Android JUnit test.

image

Step 23 : Go to Virtual device window and inspect that script will run and execute test.

image image

Step 24 : Result is displayed at JUnit Editor.

image

That’s all for now. Our next Robotium related post, we will show on how to refactor the Robotium script and write more manageable test.

Happy Automation day with Robotium …!!!

Sunday, April 19, 2015

Robotium: How to install Robotium in eclipse IDE

Robotium is an interesting tool to automate the Android application. It is an android test automation framework that can record both native and hybrid android application. It is easy to write a powerful and robust automated UI test for Android application using Robotium.

Here we will explain on how to install Robotium in our Eclipse IDE.

Step 1 : Open Eclipse IDE Editor. Note that we should have installed Java JDK and Android SDK in our machine. We should have ADT(Android Development Tools) plug in installed on our Eclipse IDE.

Step 2 : Go to Help>Install New Software

image

Step 3 : Enter the link “http://recorder.robotium.com/updates” to the “Work with” text box of Install window.

image

Step 4 : Press Enter button. Robotium is displayed at the list. Now click on “Robotium” to expand and click “Select All” button. Uncheck “Contact all update sites during install to find required software”.

 image

Step 5 : Click Next button.

image

Step 6 : Click on Next button again.

image

Step 7 : Click on “I accept the terms of the License agreement” and click on “Finish” button.

image

Step 8 : Robotium starts installing.

image

Step 9 : A security warning dialog is displayed and click on OK button.

image

Step 10 : Software update dialog is displayed to ask restarting eclipse and click on “Yes” button.

image

Step 11 : Eclipse will be restarted and Select the workspace and click OK button.

image

Step 12 : Installation of Eclipse is complete. To verify the installation click on File > New > Other…

image

Step 13 : New window is displayed with other project list. Here “Android Robotium Recorder” is displayed and click on this folder we see “New Robotium Test” project. It means that Robotium for eclipse is installed successfully.

image

That’s all for now. In our next post we see on how to record an android application and run it using Robotium.

Happy Automation day with Robotium …!!!

Wednesday, January 14, 2015

SikuliX : What is SikuliX?

Now a days automated testing is becoming popular as it is decreasing time for manual testing and also reduce the time for regular testing and repetitive testing. Among them UI automation testing is important as it is playing the real user activity over the UI. There are lots of UI testing tools in the market both open source and commercial. All of them have some pros and corns. Most of them follow the basic rule by detecting the UI components using UI’s internal structure. But some of the cases UI internal structures are so complex and dynamic that our tools cannot detect it  properly and even at run times it can detect the element and sometimes not. We can overcome this problem by using a tool that can detect a component by using its image not its internal structure. SikuliX is such a tool.

SikuliX can automate anything on the screen of the desktop computer running Windows, Mac or Linux/Unix by using  image recognition algorithm to identify the elements and do operation on the element.

Things to know about SikuliX

  • It uses image recognition powered by OpenCV to identify and control components.
  • It is useful where UI’s internal or source code cannot be accessed easily.
  • SikuliX has its own IDE.
  • It supports Python language level 2.7 (supported by Jython) and Ruby language level 1.9 and 2.0 (supported by JRuby).
  • It can be user with Java or Java aware programming/scripting language (Jython, JRuby, Scala, Clojure, ….).
  • It has its own built in image capturing tool but it also support image captured by other third party tools.
  • It can run mouse and keyboard to interact with the identified GUI elements.
  • Any types of application such as web, desktop or mobile platforms can be automated and tested through Sikuli.
  • It is not available at mobile device but it can be used on respective emulators on desktop computers or based on VNC solutions.
  • It is available for multi monitor environments and even for remote systems but it has some restrictions.
  • It can be used to search text in images by using OCR. This feature is powered by Tesseract.
  • It is a Java application and it works on Windows XP+, Mac 10.6+ and most Linux/Unix systems. For Windows, Mac and Ubuntu 12.04+ it is complete and should normally work out of the box. For other Linux/Unix systems there usually are a few prerequisites to be setup.

 

Where SikuliX can be used

  • SikuliX can be used to automate a repetitive tasks.
  • It can be used to automate task or desktop/web application for daily use.
  • To play games.
  • To administer IT systems and networks in office.
  • If there is not enough tools to automate an application then SikuliX can be a choice.
  • To test application or web that is under development.
  • It can be used to create usage documentation or training material, that run live on the addressed application or web page.
  • It can be used in an existing script used by other tools where it can automate some critical feature easily by enhancing the approach and improving efficiency and outcome.

 

Different ways to use SikuliX

There are different ways that SikuliX can be used. Using SikuliX means What You See Is What You Script.

  • By using SikuliX IDE, it can be automated the workflow by capturing and searching UI element image and doing some operation on that element with mouse and keyboard.
  • By using IDE, it can edit and run the existing script
  • Script can be run through command line
  • SikuliX can be used to write customizable automated script with the help of programming in Java or Java based programming language like Jython, JRuby, Scala, Clojure…etc.
  • In that case, script can be written by integrating the SikuliX feature library with Eclipse/NetBeans IDE and writing the script with Java or Java based language using the available API of SikuliX.
  • It can be scripted by using .Net based language like C#.

That’s all for now about SikuliX.

In my next post I will show how to install and run SikuliX, write automated test script using SikuliX IDE and so on.

Till then …Happy Automated testing using the power of image detection!!!

Cypress: How to handle browser-based authentication pop up dialog in Cypress

Five years ago I have written a blog on how to handle browser-based authentication for selenium webdriver.   Now it is for cypress. Cypress...