Thursday

JBehave Mindmap



A follow-up to the previous post here is a mind map that I had created sometime back.

Though I will not say that this is the best one out there, this for sure helps me to understand how stuff works:























 
 P.S - If you cannot see the image download the same for a better resolution.

Saturday

Let’s explore and learn JBehave !




I have off-late been doing a lot of BDD and have never written a single post about the same. There is so much about this on web that I really never felt to clone the information.
The reason I decided to write this post is to help all of them who have been asking me - how to join the JBehave bandwagon of testing using BDD approach?


Let’s get into the meat of what it takes to learn JBehave.
JBehave + Selenium +Java +Maven

Installations:
1.       JDK6+
a.       Download JDK/JRE Portable Zip from here http://staticchaos.freeoda.com/java/
b.      Set environment variables (system ) – JAVA_HOME e.g.: JAVA_HOME=C:\Program Files\Java\jdk1.7.0_10
c.       Add to Path variable - C:\Program Files\Java\jdk1.7.0_10 \bin\; C:\Program Files\Java \ jdk1.7.0_10\jre\bin
d.      Add to CLASSPATH a dot "."and e:\jdk7\jre\lib\ext
2.       Maven 2+
b.      Unzip the distribution archive, i.e. apache-maven-3.1.1-bin.zip to the directory you wish to install Maven 3.1.1. These instructions assume you chose C:\Program Files\Apache Software Foundation. The subdirectory apache-maven-3.1.1 will be created from the archive.
c.       Add the M2_HOME variable in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.1.1.
    1. In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin.
    2. Add to Path variable -%M2% to make Maven available on command line.
    3. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.
  1. Firefox 10+
    1. Add to Path variable -  C:\Program Files (x86)\Mozilla Firefox
IDE of my choice – Eclipse
1.       eclipse-java-juno-SR1-win32     
2.       m2e - Help > Install New Software... - http://download.eclipse.org/technology/m2e/releases

 Most common jars you might want to have a look at:
1.       jbehave-core-3.9.jar http://mvnrepository.com/artifact/com.google.guava

Pick any of these samples and Import Maven project into eclipse
a.       File Import existing maven projects - will download all maven dependencies and add to build path
b.      Maven > Update Project Configuration... on project (right click)


Execution and Reporting
Once you have the entire project all set, To run these stories
1.       In Eclipse Right-click on the Story class, select "Run as" -> "JUnit Test"
2.       To run stories from the command line:
       Navigate to the project where the pom.xml is located and type - mvn clean install
3.       To Run a single story based on story filter:
mvn clean install -DstoryFilter=storyName
4.       To run a suite based on the meta filters in the story files:
mvn clean install -Dmeta.filter="+page home"

Once all the dependencies are downloaded, you will see the execution results in one of the target folders: e.g.: target/jbehave/view
Generally report file is named: 'reports.html' and there should be a row for each story. The story reports are clickable via links on the right-most column.


Issues you might face
1.       Maven Unable to locate the Javac Compiler - m2eclipse is unable to locate C:\Program Files\Java\jre6\..\lib\tools.jar  http://stackoverflow.com/questions/10367286/m2eclipse-is-unable-to-locate-c-program-files-java-jre6-lib-tools-jar
2.       invalid LOC header (bad signature)  http://stackoverflow.com/questions/13044628/spring-error-during-build

Happy Testing!!!

Monday

GUI for Selenium Grid


Information on VisGrid (a GUI for Selenium Grid. You can start hub, create and attach a Selenium node very easily and quickly)




Tuesday

Encode Password using Base64 Java - Selenium Webdriver



One of the most common practice while automating websites which have passwords and other personal information  is encoding.

Base64 is a method of encoding every 3 bytes of input into 4 bytes of output; it is commonly used to encode photos or audio to send in emails, and a way to hide webpage authentication from casual snooping. Here is an example of how to code a Base64 encoder in Java for Selenium WebDriver:

 import.org.apche.commons.codec.binary.Base64

WebDriver wd = new FirefoxDriver();
WebElement pwd = wd.findElement(By.id("passwd"));

byte[] encodedBytes = Base64.encodeBase64("TextforEncoding".getBytes());
System.out.println("encodedBytes " + new String(encodedBytes));
byte[] decodedBytes = Base64.decodeBase64(encodedBytes);
System.out.println("decodedBytes " + new String(decodedBytes));

Happy Encoding!

Wednesday

Quick way to generate test data





Simply visit the web page www.generatedata.com and quickly create test data in various formats like Excel, CSV, XML, JSON, HTML

 














Note: Ensure that that you select the correct Export Type tab before hitting the Generate button

 
Advantages:
  • Easy to use GUI interface
  • Provides support to create data with custom XML and HTML structure
  • Allows for conditional data generation like generate date within specific range etc
  • Provides built in data type and support for different date format

Disadvantages:

Allows for max 100 rows of test data row to be created in one go.


Happy Test data generation!

Monday

How to change QTP / UFT Insight image during execution?



If you have started using UFT then I am sure you would have at-least given this feature a try:

UFT Insight = Image based identification

 Mandatory /assistive/smart identification does not work in Insight
Ordinal /Visual relation identifier do


Insight objects contain the image either internally (when created during record or learn) or by supplying an image using the ImgSrc property
Descriptive programming:
InsightObject("ImgSrc:=C:\Image.jpg").Click
InsightObject("ImgSrc:=C:\Image.jpg").Click

SetTOProperty:

InsightObject.SetTOProperty "ImgSrc", "C:\Image.jpg"
InsightObject.Click


Options for Insight Object are at Tools>Options>GUI Testing>Insight. This pane enables you to define options that customize how UFT handles Insight test objects


Hope you got enough insight, Happy Testing!



QTP 11.5 -> UFT


It's been sometime now that I have blogged. Too many projects and automation tools giving a good start to my 2014.

Back to the original topic of what's in it for me with UFT?

If you really do not want to  RTFM here you go:


Here is what HP had to say way back in 2012/early 2013:
"It's time to bring much awaited HP Unified Functional Testing 11.5 (QTP + Service Test = UFT) has been released today (Dec 06, 2012) at HP Discover 2012 event"
 
  1. As you would have guessed it the new version of HP QTP which is being called HP Unified Functional Testing 11.5 (UFT 11.5). UFT 11.5 is actually a combination of HP QTP (for testing GUI - Vbscript) and HP Service Test (for testing API/web services - C#).
  2. New modern unified IDE aligned with modern IDEs (like Eclipse) / have many new features such as script editing, coding, MDI, checkpoints, auto completion etc 
  3. Image Based Automation – Using HP UFT Insight  (Not very successful but is a good last resort)
  4. Integration with Open Source CI Systems like Jenkins https://wiki.jenkins-ci.org/display/JENKINS/HP+Application+Automation+Tools
  5.  UFT Mobile – Extended Support for Mobile Testing
  6. For UFT API have a look at this - The UFT API Testing Manifesto – A step-by-step, hands-on testing guide for the masses
  Happy Unified testing !
It's time to bring much awaited HP Unified Functional Testing 11.5 (QTP + Service Test = UFT) has been released today (Dec 06, 2012) at HP Discover 2012 event. - See more at: http://www.automationuft.com/2013/01/uft-115-automation-software-testing.html#sthash.0ahx78uF.dpuf
It's time to bring much awaited HP Unified Functional Testing 11.5 (QTP + Service Test = UFT) has been released today (Dec 06, 2012) at HP Discover 2012 event. - See more at: http://www.automationuft.com/2013/01/uft-115-automation-software-testing.html#sthash.0ahx78uF.dpuf
It's time to bring much awaited HP Unified Functional Testing 11.5 (QTP + Service Test = UFT) has been released today (Dec 06, 2012) at HP Discover 2012 event. - See more at: http://www.automationuft.com/2013/01/uft-115-automation-software-testing.html#sthash.0ahx78uF.dpuf