Saturday, May 31, 2014

How to run your first java program?

How to run your first java program?

Well you are the person who is waiting to understand how do you print the text  "I want to become Manual to Automation tester." using Java program.

Follow the steps:

1. open your Notepad++, i have told you to install in my last posting.

2. Now save the file name say 'ManualToAutomation.java' where .java extension file format in Java.

3. Enter the below code.

class ManualToAutomation{ // Note: File name and class name should be same

public static void main(String[] args){  // main Function.

System.out.println("I want to become Manual to Automation tester.");
}

4. Now navigate to the folder path where the "ManualToAutomation.java"  file is saved.

5. Now enter the command in DOS command prompt
javac ManualToAutomation.java
and press ENTER button.
Note: javac - is a java compiler.

6. Observe the "ManualToAutomation.class" file is created which is a byte code file. which is created by our program after compiling.

7. Now to run the below command to work our program
java ManualToAutomation

and press ENTER button, Note that I have not added any file extension.
8. Observe the DOS command prompt screen will print the line "I want to become Manual to Automation tester." which is entered in the program file.


Remember these: 
1. Main function should be there to run the program,  otherwise program throws "Exception in thread "main" java.lang.NoSuchMethodError: main". You can  compile the program without main function.
2. 'S' Should be uppercase in System.out.println("")
3. File name and class name should be same and save the file extension in .java , for good practice.

Star pattern using java programming - Basic programming


How do you print the  stars (*)  using program?? this will help you to improve your logical thinking while performing basic  programming, This is required for our selenium webdriver automation.


*
**
***
****


*****
****
***
**
*

Please try to solve the above problem without referring [Hint- Use 2 for loop]. I will provide the solution in a separate post.

Difference in "String[] args" vs "String args[]"


What is the difference in the below notation???

public static void main(String[] args)
public static void main(String args[])

Answer: - Both are same, and both are array of string like args[0,1,2.......n]

Installation of JDK and Notepad++

Well, guys we are aware of the list of items need to learned to become automation tester mentioned in my last post "Want to switch your career from 'Manual testers' to 'Web Test Automation'?".

We will start with installation of JDK 1.6 + and Notepad ++. We have decided to learn the automation from the scratch to scratch our head :)

We will start with basic programming, where we are not going to use any IDE (integrated development Environment, like Eclipse/Net-beans, etc.,)  until we strong with the basics.
Download files from:
Click here to download JDK.
Click here to download Notepad++

So please install the JDK 1.6 and above version, also install Notepad++. Choose the right version of JDK based on you system configuration (32/64 Bit processor), then you need to set the JDK path in the "Environment Variables".

Follow the below steps to setup the JDK path in the "Environment Variables". (Here example is given for Windows -7)
1. Right click on the Computer in start up menu
2. Click on the properties, you will be taken to Control panel home page
3. Now click on the "Advance System settings" link will open the "System properties" popup
4. Now click on the Advance tab and click on the "Environment variable" button, JDK path.

Note: Already some other path might be there then dont delete it, otherwise it will cause an issue with other application which are already added in the path, instead of that go to end and enter a semicolon (;) and include your local JDK path and save.

After following above steps, then how do you check the Java is installed in your machine or not?

Follow the below steps
1. Go to start menu and type the 'CMD' on the run field.
2. You will get DOS command prompt - command line interpreter
3. Enter the command  'java -version' and  hit ENTER button (dont forget to add one space after word 'java' and no space after hyphen, otherwise you end up with error)

Now you have successfully installed JDK and ready to work on the Basic programming.

Note: 

  • What is JDK - Java Development Kit - which is required to compile the program.
  • What is JVM - Java virtual machine - This is an environment where java program can be compiled and executed. 
  • What is JRE - java Run-time Environment - This  is required Java program execution or Run time environment. 


Want to switch your career from 'Manual testers' to 'Web Test Automation'??

You want to move your career from Classic 'Manual testers' to Smarter way of 'Web Test Automation'??

Hurrah! Here is the solution ;) Lets start with Selenium-webdriver. Which is now ruling web automation industry.

I am writing this post to help to a basic manual tester/ fresher who are aspire to become automation tester or make their career.
If you dont know from where to start?!!!!!!!!!!!!!!!!
You are landed on the right blog for the information. Dont worry here is list you will be trained to achieve your success and move towards your career.

1. Basics of Programming Language. - This Skill is required to improve your logical skills, this is very much required to work with selenium-webdriver automation.

2. Java
|->  Oops Concept - World is crazy about this :) obviously you also!! so you need learn.
|-> Abstraction
|-> Inheritance
|-> Encapsulation
|-> Polymarphism
|->  Collection
|-> Exception handling
|-> File I/O
|-> Data base

3. Web element Locators - name, ID, Linktext, xpath, CSSlocator,class, DOM
4. Selenium webdriver - basic, advance
5. TestNG - a unit testing framework, comes with handy annotation and you can control your test automation scripts.
6. Frameworks - Data driven, modular, Keyword, hybrid and POM (Page Object Model) - This is required to maintain the scripts.
7. Automation Test management tools - ANT, Maven, SVN, Hudson
8. Selenium Grid

Well we will start working on each one to Achieve our dreams!!!
All The Best.

Why Selenium (webdriver) in web automation??

Why Selenium - webdriver in web automation??

Well below are some reason will become the answer for above question.

1) Open source and free web automation tool
2) platform independent, can run on Windows (XP/7/8)/ Macintosh (MAC)/ Linux (Ubuntu,fedora,Red-hat etc)
3) Supports multiple browser.
4) supports for web application
5) Mobile automation
6) Flash automation
7) Native Library to the browser.
8) User support - vast community and growing
9) Industry movement towards stand alone to web.

Sunday, December 12, 2010

Sahi - Web automation Tool

Hi All,

I have come across a wonderful tool for Test automation of the web application. The Tool Named it as "SAHI" yaani (Hindi word) Correct/ perfect.

I was in the search of good open source tool, which should avoid the developing the code from scratch as like development for testing practices.

Tester tool should be so friendly, so that the tester should not worry about the coding part for the automation. But tester should think about the generating the test data’s and testing scenario’s.

For a tester a tiny tool which does most of the things other than logic's (after all testers have to think about the logic :) ) then, tester job becomes easy.
I have personally tried and invested time for POC for the tool "SAHI" which works wonderfully for the tester. This has an advantages and disadvantages features like human beings :).

Sahi is comes in 2 flavors, one is Open source and other is Pro edition.

Advantages:

1) OS & Browser independent.
2) Record & playing the scripts through the Sahi proxy from any browser (Change the Browser settings to localhost: 9999)
3) Simple API's and easy coding with JavaScript’s.
4) In-build reports, and easily customizable API's
5) Good Ajax support no waits required in the scripting.
6) Good object identification option on the sahi controller, easily test the line of scripts and upend to the script file. Tester can see the history of the recorded scripts and can modify/clear.
7) Parallel running multiple scripts on multiple browser Using ANT. (This is wonderful feature of this tool)
8) Step by step execution of the script using sahi controller.
9) Good support for external proxy, HTTPS, 401 & NTLM authentications

Limitations:
1) Framesets/pages with frames/ iframes loading pages from multiple domains are not supported.
Sahi cannot handle pages which have other pages from different domains embedded in them using iframes or frames. So you cannot have a page from google.com having an iframe with a page from yahoo.com. Note that this is not the same as switching between domains, where you navigate from a google.com page to a yahoo.com page, which will work in Sahi.
2) File upload field will not be populated on browsers for JavaScript verification. File upload itself works fine


Last word but not least, while selecting the Open source testing tools, we need to make ourselves a decision which tool is suited for our application to test.

Reference Links:

website: http://sahi.co.in/w/

For Download the latest tool: http://sourceforge.net/projects/sahi/files/

How to Use: http://sahi.co.in/w/using-sahi

Sahi Documentation: http://sahi.co.in/w/sahi