Tuesday, 16 May 2017

SIKULI GUI Automation Tool (Introduction)

                Sikuli GUI Automation Tool 



Introduction:

Sikuli is a tool to automate graphical user interfaces (GUI) using “Visual Image Match” method. In Sikuli, all the web elements should be taken as an image and stored inside the project. 
          Sikuli can be very much useful to automate flash objects (which do not have ID or name). It can be useful in the situation, where we have a stable GUI (i.e. GUI components not changing).
            Even Window based applications can also be automated using Sikuli. Sikuli provides very friendly Sikuli-script.jar, which can be easily used together with Selenium WebDriver. We can even automate Adobe Video/Audio player, Flash Games on website using Sikuli.
Why Sikuli?
Sikuli automates anything you see on the screen. It uses image recognition to identify and control GUI components. It is useful when there is no easy access to a GUI's internal or source code.

Practical Uses:

1.     Sikuli can be used to automate Flash Objects / Flash Websites.
2.     It can be useful to automate Window based application. We can automate, what we are seeing on the screen.
3.     It provides, simple API. i.e. all methods can be accessed using screen class object.
4.     It can be easily integrated with Selenium and all other tools.
  1. Using Sikuli we can automate desktop applications.
 Benefits of sikuli:
  • Open source Tool.
  • One of the biggest advantage of Sikuli is that, it can easily automate Flash objects.
  • It makes easy to automate windows application.
  • When you’re testing an application under development and you don’t know the ID/name of the elements, then you can go with Sikuli. It will check the appearance of the image and if match found, it will interact with the image accordingly.
 Steps to Create Sikuli Java Project:
Step #1: Sikuli Download – Download Sikuli from here.
Step #2: Extract the zip file which you’ve downloaded. It will contain sikuli-script.jar file. Save this extracted file in your local file system.
Step #3: Open Eclipse.
Step #4: Create a java project File -> New  -> Java Project
Step #5:
  1. Right Click on the project
  2. Go to Build path   -> Configure Build Path
  3. Switch to Libraries tab
  4. Click “Add External Jars” button and Add Sikuli-Script.jar in the Build path.
  5. Click “Ok”.

Share:

Monday, 15 May 2017

MAVEN TOOL

                                      MAVEN TOOL

What is Maven?

Maven is a project management and comprehension tool. Maven provides developers a complete build lifecycle framework. Development team can automate the project's build infrastructure in almost no time as Maven uses a standard directory layout and a default build lifecycle.
In case of multiple development teams environment, Maven can set-up the way to work as per standards in a very short time. As most of the project setups are simple and reusable, Maven makes life of developer easy while creating reports, checks, build and testing automation setups. 

Maven Phases
Although hardly a comprehensive list, these are the most common default lifecycle phases executed.
§  validate: validate the project is correct and all necessary information is available
§  compile: compile the source code of the project
§  test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
§  package: take the compiled code and package it in its distributable format, such as a JAR.
§  integration-test: process and deploy the package if necessary into an environment where integration tests can be run
§  verify: run any checks to verify the package is valid and meets quality criteria
§  install: install the package into the local repository, for use as a dependency in other projects locally
§  deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
There are two other Maven lifecycles of note beyond the default list above. They are

§  clean: cleans up artifacts created by prior builds

STEPS TO CREATE A MAVEN TOOL:

steps1:

1.Download jdk8
2.Instal in tester computer
3.create JAVA_HOME environment variable
4.extend "path"variable value.

steps2:

Download eclipse IDE
Launch eclipse IDE and specify workspace to store scripts or programs.

steps3:

1.Goto help menu in eclipse IDE
2.click instal software option
3.click  add
4.enter name as M2Eclipse
***************************
click next until finish.( maven plugin to eclipse IDE was installed)
***************************

steps4:

File menu in eclipse IDE-->new-->other-->maven-->maven project-->click next-->select create a simple project option-->click next-->enter group id-->enter artifact id-->click finish.

Note:

After completion of maven  project creation ,we need to set compiler version and JRE version to latest by using "properties" option.

steps5:

Open POM.xml-->insert<dependencies>tag-->get and paste dependency code.

What is pom?

POM stands for Project Object Model. It is fundamental Unit of Work in Maven. It is an XML file. It always resides in the base directory of the project as pom.xml.
The POM contains information about the project and various configuration detail used by Maven to build the project(s)
eg:

<dependency>


    <groupid>org.seleniumhq.selenium</groupid>


    <artifactid>selenium.java</artifactid>


    <version>3.4.0</version>


</dependency>


First let us create a simple maven project;
Step 1: Navigate to File Menu -> New, and check if Maven Project is displaying if yes, click on Maven Project. If NOT, please click on Other.
Maven project selection.
Step 2: After Clicking on Other, it will display 'select a wizard' screen, please type as Maven in the text box to filter and find Maven. After that Select Maven and Click on next button.
Filter Maven project.
In the next screen, it will ask you to select project name and location. By default, 'Use default workspace location' will be selected. Just click on next button to proceed without making any changes.
Step 3: In the next screen, It will ask you to select an Archetype. Depending on the type of project that you are working, you need to choose the archetype.
select maven Archetype.
Here we will choose a basic archetype 'quickstart' and Click on Next button
Step 4: It will ask you to 'Enter a group id for the artifact.' Click here to know more about Group ID and Artifacts.
We will input as shown in the below image. Version number will be by default 0.0.1-SNAPSHOT
Maven Artifacts.
Step 5: Click on Finish. Now Creating a maven project is Done. Lets see how the project is created. If you expand and see the project structure,
Maven project.
If you observe, it has downloaded Maven Dependencies. You can see by expanding the Maven Dependencies. And also it has created pom.xml file. The below is the pom.xml file which got created.
Advantages: 
1. Selenium is pure open source, freeware and portable tool. 
2. Selenium supports variety of languages that include Java, Perl, Python, C#, Ruby, Groovy, Java Script, and VB Script. etc. 
3. Selenium supports many operating systems like Windows, Macintosh, Linux, Unix etc. 
8. Selenium can be integrated with other open source tools for supporting other features.
10. Selenium supports very less CPU and RAM consumption for script execution.
Disadvantages: 
1. Selenium needs very much expertise resources. The resource should also be very well versed in framework architecture. 
2. Selenium only supports web based application and does not support windows based application. 
3. It is difficult to test Image based application. 
4. Selenium need outside support for report generation activity like dependence on TestNG or Jenkins. 
5. Selenium does not support built in add-ins support. 
Share:

Sunday, 14 May 2017

Gmail application

GMAIL APPLICATION:USING SELINIUM TOOL(AUTOMATION)

SCENARIO:

Login to gmail application capture number of unread message available in inbox table.



program:

package practice;

import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Gmail {

public static void main(String[] args) throws InterruptedException 
       {
FirefoxDriver driver=new FirefoxDriver();

driver.manage().window().maximize();

driver.get("https://gmail.com");

driver.findElement(By.id("identifierId")).sendKeys("abc@123@gmail.com");

driver.findElement(By.xpath("//span[text()='Next']")).click();
           
Thread.sleep(4000);

driver.findElement(By.name("password")).sendKeys("******");

driver.findElement(By.xpath("//span[text()='Next']")).click();

Thread.sleep(25000);

String actmsg=driver.findElement(By.xpath("//a[contains(text(),'Inbox')]")).getText();

System.out.println(actmsg.substring(7, actmsg.length()-1));
driver.findElement(By.xpath("//span[@class='gb_9a gbii']")).click();

driver.findElement(By.xpath("//a[text()='Sign out']")).click();

driver.quit();


}

}

Note:
1. driver.findElement(By.id("identifierId")).sendKeys("abc@123@gmail.com");..(example) we have to give your own mail id

2.driver.findElement(By.name("password")).sendKeys("*****");....(example)
we have to give your own password

Share:

ACTI TIME APPLICATION



package practice;

import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;

public class actitimepractical {

public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub

String Expmsg="Customer has been successfully registered";

//navigate to actitime

FirefoxDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://localhost/login.do");

//login to actitime
driver.findElement(By.name("username")).sendKeys("admin");
driver.findElement(By.name("pwd")).sendKeys("manager");
driver.findElement(By.xpath("//input[@type='submit']")).click();

driver.findElement(By.xpath("//a[text()='Projects & Customers']")).click();
Thread.sleep(25000);
driver.findElement(By.xpath("//input[@value='Add New Customer']")).click();
Thread.sleep(4000);

driver.findElement(By.name("name")).sendKeys("abc165");
driver.findElement(By.name("createCustomerSubmit")).click();

String actmsg=driver.findElement(By.xpath("//span[contains(text(),'Customer has been successfully registered')]")).getText();
if(actmsg.contains(Expmsg))
{
System.out.println("pass");

   }
else
{
System.out.println("fail");
}

driver.findElement(By.xpath("//img[@class='logoutImg']")).click();

}


}


Points:
1.First we have to install acti time application
2.we have to install the eclipse and that add selinium web driver jars files.
3.create a new project
4.create new class

ACTI TIME APPLICATION:
1.Navigate to actitime.
2.login to acti time
3.click on project and customer link
4.click on create new customer button and create customer
5.logout

Note:
 we have to change your own customer names
driver.findElement(By.name("name")).sendKeys("abc");.....(example)







Share:
Testersonly. Powered by Blogger.