Posts

Showing posts from 2014

AngularJS vs PolymerJS Testing

Image
What is Angular? Angular is a complete framework for building web apps. It has high-level APIs for things like services, routing, server communication. Here are some features that Angular offers: Directives  Dependency injection Testing support Routing Services Server communication What is Polymer? Polymer is a library for creating Web Components, which are a set of W3C standards and upcoming browser APIs for defining your own custom HTML elements. Here are some features that Polymer offers: Declare custom elements Widgets Polyfills for new web platform features Encapsulation for the DOM Built on emerging web standards Even though Angular and Polymer aim to do different things, there is currently some overlap. Web components and Angular’s element directives are very similar, and if there’s a comparison to be made it should be between Polymer’s Custom Elements and Angular’s directives. Summary - Angular, a MVC framework, and Polymer, polyfills an

Box full of testing mindmaps

Image
Here is the best collection of testing Mind-Maps I have seen : http://apps.testinsane.com/mindmaps/ Have fun browsing!

Unable to charge the iPad using USB

Image
Now here is a scenario where I am automating applications on an iPad. The iPad is connected to the usb port of a machine which has all other testing devices connected. Problem: There is a known issue with iPad not charging and if you search forums you will notice the solution that says " Charge via a wall outlet if your computer USB port does not support high power output...most older computers do not have high power USB ports, and some of the new models still lack those ports. " This was not a viable solution as I had multiple users accessing this machine and the test devices had to be plugged into the system round the clock. Solution: What I finally did and that helped - ASUS came up with a software to deal specifically with charging issues related to Apple devices. It works by simply increasing the USB port’s power output. This should work with all motherboards and computers (Windows platform only) as claimed by ASUS. Step 1 : Download the software from here

Parameterize properties file in Java

Image
If you are using a properties file and passing key value pairs, there are instances when you would want to parameterize the values passed. In my case the dynamic xpaths need to be parameteized for more flexibility Solution:  MessageFormat Steps to achieve this : Your properties file should have the key value as : HomePage.DynamicObject.Button=//*[@text= ''{0}'' and @width>0]  In the above statement {0} is the parameter  In your class file that calls the property Properties obprop = new Properties(); String Locator= MessageFormat.format(obprop.getProperty(Object_Identifier), params); where Object_Identifier is HomePage.DynamicObject.Button and params is the parameter you want to pass Note:   Within a String, a pair of single quotes can be used to quote any arbitrary characters except single quotes. For example, pattern string "'{0}'" represents string "{0}", not a FormatElement. ... Any unmatched quote is tr

Cheatsheet Git

Image
Here is an awesome cheatsheet for the git repo: P.S: Download the file for clarity

Remove duplicate lines from a file

Image
Problem: You have two files that you have merged but now there are duplicate lines you want to omit. Solution: There are many ways to do this but the easiest is to use this utility: http://textmechanic.com/Remove-Duplicate-Lines.html

Eclipse Referenced Libraries disappear

Image
Automating using Java Eclipse?  Problem:   In Java projects in Eclipse sometimes the folder "Referenced Libraries" disappears from the "Project Explorer" view. All third party jars are shown directly in the root of the project folder Solution 1:   B ring up the "Package Explorer" view (instead of the "Project Explorer" view). Solution 2:   C lick on the little "down arrow" icon in the top-right corner of the Package Explorer view. In the context menu that appears, one of the items on the menu is "Show 'Referenced Libraries' Node." Click on that menu item.

Eclipse Cucumber Plugin - Syntax highlighting not working feature file

Image
If you have just installed the eclipse plugin for cucumber and the feature file steps are not colored then here is the simple solution. Obviously you have already checked the following: Plugin Installed correctly Extension of this file is correct. Solution:  What went wrong is that you have accidentally opened the file with 'Text Editor'. All you need to do is change the default to "Editor" 

Device Enablement in SeeTest

Image
The new feature of device enablement has made iOS mobile automation easy. Now we do not need a provisioning profile !! Here are the steps tried first hand: When you add a new device and select the checkbox for instrumented device, you now see a message: Choose the option for device enablement and click ok, you will see an automated mail sent to you   Once you have received the email on confirmation another email will be sent to the support as a request: Within a few hours you will receive a link to download the .def file! Happy iOS automation!!!

Key Events in Android Device Automation

Image
If you are looking to automate your android device there are instances when the automation tool/scripts need to run the adb shell commands to achieve the actions: If you are using seeTest one of them is: client.run("adb shell input keyevent 26"); For more commands look at: http://developer.android.com/reference/android/view/KeyEvent.html Happy Android automation!

List of free software testing eBooks

Image
Here is a an interesting list of free software testing eBooks that Sergey has on github https://github.com/ligurio/free-software-testing-books/blob/master/free-software-testing-books.md Happy Reading!

Node Grunt error enoent stat roaming npm

Image
If you are working on protractor or any similar application, the prerequisite is to install node and grunt. Installing node is a child's play but if you are trying to install grunt npm install -g grunt-cli It bombs and says   Error: ENOENT, stat 'C:\Users\Ady\AppData\Roaming\npm' Solution:  Manually creating a folder named 'npm' in the path that it specifies , in this case  C:\Users\Ady\AppData\Roaming\npm Reason: a   bug in latest NodeJS for Windows installable Tip: Run the command prompt as administrator.

PhantomJS Selenium Webdriver Java - setup and Error trying to find element with xpath

Image
If you have a Selenium Webdriver framework that is working at its best! All you now need is  a headless browser like PhantomJS to test your web applications that make the functional tests faster. (According to their website PhantomJS is “a headless WebKit with JavaScript API.” Webkit is the layout engine used by a few browsers, such as Chrome and Safari. So PhantomJS is a browser, but a headless one.) Here are simple steps to add this capability in your selenium scripts: Download PhantomJS and extract the package. or windows its an exe file and for Mac its just a zip package you will need to extract.  Extract the phantomjs-1.9.x-windows.zip folder and locate phantomjs.exe file.  Copy this file to a common location where the framework libs are stored.(In my case I used the same space as ChromeDriver and IEDriver)  Add the following imports to your code: import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.phantomjs.PhantomJSDriver; impor

Schedule a Java ANT program on windows

Image
This is the easiest way to schedule a ANT build.xml script that you want to Run on any machine Make sure you can navigate to the path where you have the build.xml stored and run the ant command from command prompt Once confirmed that you are able to run the script from the command line Create a .bat file with just one word ant in it. This does not do any exception handling Open the control panel -> System and Security -> Power Options  and make sure that the computer never sleeps option is set (you need admin rights) Open the control panel -> System and Security -> Administrative Tools -> Task Scheduler Create a new task and navigate to the path of the .bat file in the Actions Tab under start a program Make sure the "Start In (Optional)" field has the absolute path to the file (without quotes) The final change is assigning the "Full Control" permission explicitly to .bat file for the account running the task. Note: Make sure

Performance testing with Selenium Webdriver - Navigation Timing API

Image
In continuation to my previous post on performance testing with Selenium Webdriver , I found the " Navigation Timing API " the best way as it has loads of parameters that we can slice and dice the way we want to get different performance parameters like: "Total Time:"+(loadEventEnd - navigationStart)/1000 + " seconds"+ " "Server Render Time: "+ (responseEnd - requestStart) + " milliseconds" "User Experience: "+ (domComplete - requestStart) + " milliseconds" "Network:"+ (connectEnd - navigationStart)/1000 + " seconds" "Server:"+ (responseEnd - requestStart)/1000 + " seconds" "Browser:"+ (loadEventEnd - domLoading)/1000 + " seconds" The properties you can play with are: The meaning of these events is described in Microsoft's performance.timing documentation  a nd more formally in the W3C Recommendation

Performance Testing using Selenium Webdriver

Image
Yes we know that Selenium Webdriver is a functional testing tool and is not a recommended option to do performance! But then there are times that you want to just do a quick performance check and find the bottlenecks in your application, here is how: The solutions here are organised based on the complexity and detail you want to achieve: Solution 1:   Measuring performance using a Timer in Selenium WebDriver We can use the the StopWatch class for measuring the time taken for the page to load or any inbuilt date time calendar feature: StopWatch pageLoad = new StopWatch(); pageLoad.start(); //Perform your test pageLoad.stop(); System.out.println("Total Page Load Time: " + pageLoad.getTime() + "milliseconds"); Or Calendar cal = Calendar.getInstance(); Date d1 = cal.getTime(); //Perform your test Calendar cal2 = Calendar.getInstance(); Date d2 = cal2.getTime(); long diff = d2.getTime() - d1.getTime(); long diffSeconds = diff / 1000 % 60; long di

Happy World Tester's Day!

Image
Now this is a day that I love, though I was introduced to this just three years back and if you are still wondering what is it all about: On September, 9 1945 the scientists of the Harvard University while testing the computer Mark II Aiken Relay Calculator had found a moth which got stuck between the contacts of the electromechanical relay.  The work they performed required some description, and the word had been found – «debugging» (literally: disposal of an insect) – and now it is used to describe the process of identifying and eliminating bugs which cause a computer to malfunction. The removed insect was pasted into the computer log with the entry: “First actual case of bug being found”, and was then transferred to the computer museum. Now that you know, Happy Tester’s day !

SeeTest Cheatsheet for Mobile test automation

Image
Here is the first of its kind a cheat sheet for SeeTest mobile test automation: P.S: Click on the image to download a larger copy. You can also email me for an excel version for easier navigation! Happy Mobile testing!

Remotely access a Mac machine from windows machine

Image
There are many tools that allow you to remotely log-in either between two Windows / two MAC machines. There are five tools that I evaluated while choosing which one is the best to remotely access apple Mac OS X from Windows.  TeamViewer LogMeIn RealVNC Vine Server Remote Management The best tool that I thought when it comes to automation is the free version of LogMeIn. The reason being the refresh rate and the connectivity. You can write a small script that can even help you schedule tests on the remote machine! LogMeIn is Free  Web interface or the Firefox plugin.  Easy steps  First you will need to create a free account Login from the Mac computer and click the Add Computer button to download the LogMeIn Installer.  After installation, you can access that computer from any other computer by logging in to LogMeIn.

Modify the IP headers on the iPhone / Bypass or change the ip on any device

Image
Problem: If we need to test an application which is outside the network or with a different IP address how do we do that? we need to be able to use a proxy server that bypasses or replaces some properties that can be then used to modify the way the application is accessed. Solution: Here is an example of how to do that on an iPhone (You can do this for any device) : Go to settings in iPhone and modify the manual IP address. Give it the same IP address as that of the local machine where the proxy server would run and select a valid port : say 8080 To set the IP headers or proxy download the Burp Free edition from here:  http://portswigger.net/burp/download.HTML Go to the Intercept tab and make sure it is off. Go to Options tab and edit the Proxy listeners to local ip of the machine: Scroll down to Match and Replace Pick a Request header not in use and modify that: In our case “Client-Version” to Now check the  HTTP history tab to confirm that the header is replaced wh

How do I get my Nexus 7 to show up in the adb devices list ?

Image
Problem: Nexus 7 that I'm trying to connect to Windows computer for automation over adb No device driver for nexus 7 ? What did not work: I did click on the build number 7 times to get the developer options enabled Tried connecting both as a Media device (MTP) and as a Camera (PTP). ("Connected as a media device" up at the top left corner, de-selecting Media Device (MTP) and then checking Camera (PTP).) downloaded this usb driver: http://dlcdnet.asus.com/pub/ASUS/EeePAD/nexus7/usb_driver_r06_windows.zip Go to the device manager , right click the nexus device and choose properties, choose "hardware" and then choose update your driver , choose manualy and pick the folder you opend the zip file to and press apply. What worked for me: The universal adb driver installer worked for me. Download the universal driver exe Run with the device connected and it will give you an option to install.  http://adbdriver.com/ Install that and you will

Funny way to enable developer options on android

Image
Problem :  Toggle on the "USB Debugging" in the "Developer Options" area of Settings in an android device This is a prerequisite to perform automation. Solution: If you do not see "Developer Options" Go into "About device" in Settings  Tap on the "Build number" entry seven times, which will unlock "Developer Options". So it's that simple tapping  the build number will make you a developer :P

Install eclipse on Mac OS X 10.9 onwards / JRE or JDK must be available in order to run Eclipse.

Image
If you are seeing this error while launching eclipse after an update to your Mac machine: "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse." There are couple of solutions: editing  eclipse.ini , adding in vm /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/bin/java  just before the  -vmargs editing the  Info.plist  and adding the full path to the Oracle SDK, checked if syntax was correct by double clicking and succesfully opening it and verified that the path was correct. adding 4 capabilities to the JDK: CommandLine JNI BundledApp WebStart Applets The eclipse.ini entry must have -vm on a separate line from the path - vm / Library / Java / JavaVirtualMachines / 1.7 . 0.jdk / Contents / Home / bin / java All this after installing JDK7 and on my Mac I still see errors!! What finally worked: Downloa

SeeTest - Launch iOSBridge automatically

Image
If you are automating your apps on seeeTest + iOS and you see that the iOS Bridge just goes blank and says disconnected. You know that your tests will not run as the prerequisite for any test to run is that you need to have the iOS Bridge running in the background. Solution: Manually launch iOS Bridge on your phone. But what if your devices are located on a remote system and cannot be accessed ?? Solution:    Using the  Runtime Application Manager  mechanism The Application Manager is used primarily to install and instrument applications so that their Native and Web elements/objects can be used to test them .Applications are generally imported from the local disk of the tester's computer. Click on the 'Application Manager' button in SeeTest located under Applications on the left hand side corner. The icon looks like an import button The Application manager will then appear on your screen and you need to import the ipa file that is located in  < SeeTest  Ins

Working on iOS Testing and want to add to the classpath on OSX / Mac

Image
If you want to make a certain set of JAR files (or .class files) available to every Java application on the machine, then your best bet is to add those files to /Library/Java/Extensions. Or, if you want to do it for every Java application, but only when your Mac OS X account runs them, then use ~/Library/Java/Extensions instead. In OSX, you can also set the classpath from scratch like this:export CLASSPATH=/path/to/some.jar:/path/to/some/other.jar Or you can add to the existing classpath like this:export CLASSPATH=$CLASSPATH:/path/to/some.jar:/path/to/some/other.jar Happy iOS testing!

Appium - Mobile test automation on a real device

Image
If you are looking to perform test automation on a real device (iPhone in my case) and you have had problems with the documentation on the official Appium website , the following post will help you for sure: Prerequisites:  Apple account with valid apple ID  Download and Install Eclipse on your Mac – A link that might help you with the installation process http://www.cs.dartmouth.edu/~cs5/install/eclipse-osx/ Download and Install Xcode Download Selenium Jars for java from the Selenium website Download the java client libraries from http://appium.io/downloads.html Download and install appiumD download the latest version from Appium.io. Mount the disk image.   Drag Appium.app to your Applications folder Download and Install brew (The missing package manager for OS X) It's on the bottom of the Homebrew homepage. http://brew.sh/  ( Yeah, it would be helpful if it was listed at the top, instead.) From a Terminal prompt:    ruby -e "$(curl -fsSL https://raw.git