Posts

Showing posts from October, 2014

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!