Posts

Showing posts from 2018

Automation 4 absolute beginners - XPATH practical usage

https://devhints.io/xpath#boolean-functions

Apache POI - Reading excel data row by row

Image
Program to read Excel data & store it in Array List - Each row as an object containing column data in the form of Strings //Function to read Excel Data - Row by Row public void getTest() throws CustomException { // array list to read each row's data as one record - i.e each test steps is stored as one record ArrayList<Object> excelData = new ArrayList<>(); //store each row data as an object XSSFSheet sheet = getExcelReader().getSheet("Functions"); for (Row row : sheet) { // each column data in the row[Test step] is read to list List<String> data = null;    data = new ArrayList<>(); for (Cell cell : row) { data.add(cell.getStringCellValue());   //each column value in the row is read one after the other & copied to array list } //once complete row data - all the columns are copied to an array list // Now this list is treated as a list object & added to one more arr...

QA's approach 2 Java - Map Interface with Examples

Map Interface Used for storing key value pairs Linked HashMap: Will retain the Entries in the insertion order.  HashMap: Will not retain the Entries in the insertion order.  Methods in Map Interface: public Object put(Object key, Object value):  This method is used to insert an entry in this map. public void putAll(Map map):  This method is used to insert the specified map in this map. public Object remove(Object key):  This method is used to delete an entry for the specified key. public Object get(Object key): This method is used to return the value for the specified key. public boolean containsKey(Object key):  This method is used to search the specified key from this map. public Set keySet():  This method is used to return the Set view containing all the keys. public Set entrySet():  The entrySet( ) method declared by the Map interface returns a Set containing the map entries.  Each ...

Selenium 4 absolute beginners - Maven POM file explanation with Sample POM file

Sample POM file <project xmlns="http://maven.apache.org/POM/4.0.0"        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">        <modelVersion>4.0.0</modelVersion>        <groupId>com.Company.ProductNameAutomation</groupId>        <artifactId>ProductNameAutomation</artifactId>        <version>0.0.1-SNAPSHOT</version>        <properties>               <jre.level>1.8</jre.level>               <jdk.level>1.8</jdk.level>        </properties>        <dependencies>             ...

Selenium 4 absolute beginners - How to create Batch execution file

Sample Batch Execution file @echo off :: Delete the existing log file ERASE C:\Softwares\Workspace\ProductNameAutomation\build.log :: Create a new Empty log file  echo.>C:\Softwares\Workspace\ProductNameAutomation\build.log :: Setting project Home Path SET PROJECT_HOME=C:\Softwares\Workspace\ProductNameAutomation cd %PROJECT_HOME% echo CURRENTLY WORKING ON DIRECTORY %PROJECT_HOME% PATH echo Setting configurations SET M2_HOME=C:\Softwares\Workspace\apache-maven-3.5.4 SET M2=%M2_Home%\bin SET path=%M2_Home%\bin ::SET Java_Home="C:\Program Files (x86)\Java\jdk1.8.0_181" ::Start the test case echo test execution in progress call mvn -f C:\Softwares\Workspace\ProductNameAutomation\pom.xml clean install compile test -X -l C:\Softwares\Workspace\ProductNameAutomation\build.log echo test execution in completed :: Generating report based on above ran test cases echo Report generation is in progress call mvn surefire-report:rep...

Automation 4 absolute Beginners - Selenium Test Setup integration with Maven & TestNG

Click on the link to have apractical view of the dicussion

Automation 4 absolute beginners - JQuery Selectors

JQuery-Selectors: A JQuery selector is a function which makes use of expressions to find out matching elements from a DOM based on the given criteria. How to use selectors: The selectors are very usefull and would be required at every step while using JQuery. They get the exact element that you want from your HTML document. JQuery Selectors: Selector Example Selects * $("*") All elements #id $("#lastname") The element with id=lastname .class $(".intro") All elements with class="intro"  Element $("p") All p elements .class, .class $(".intro, .demo")        All elements with the classes "intro" and "demo" :first $("p:first") The first p element :last $("p:last") The last p element :even $("tr:even") All even tr elements :odd              $("tr:odd")         ...

Selenium - JavaScript Executor

Image
Practical usage of javaScriptexecutor Selenium Webdriver works similar way to an user does actions on the browser web pages, hence when user is not able to interact with an element on web page, even the webdriver will not be able to do so. But using javascript, we will be to interact with that webelement.  So this doesn't provide us an accurate result, thus even a failed case may be passed due to this. To avoid this, prior to trying with JavascriptExecutor, we must try to execute our selenium code with different browser, if it behaves differently with other browsers then only we should go for the JavascriptExecutor, but if the test is failing in all browser then we should fail the testcase. What is Javascript A Javascript is a small chunks of program that makes a website interactive. For example, a javascript could create a pop-up alert box , or provide a dynamic dropdown menu. JavaScript code can listen to even on the web page like reacting to a click on a button,...

Basic HTML insights for QA's

Basic understanding of HTML Whats the purpose of Tags & Attributes? Tags of HTML tell the browser what to present, its attributes tells how to present that. Attributes helps in improving the appearance of a web page Commonly used Tags & their purpose HTML form is a container and it can contain one or more buttons, text boxes and other form elements. Input tag We use input tag to create form elements like radio, button, submit etc Option tag The <option> tag is used to define the options in the drop down list. Frameset tag It is used for creating frames. A <frameset> element holds one or more <frame> elements. When we are creating frames we are actually working with multiple html documents. List tags Order list -> ol Unorder list -> ul li Tag: The content of the list is created using <li> tag Div Tag Div stands for division because it divides the content into individual sections. It is used as a container to group bloc...

Automation 4 absolute beginners - Selenium WebDriver_Locators

WebElement Location Statergies: To get know the basic usage of HTML tags - Click Here All the elements on the web page are called WebElements in selenium webdriver. To identify the elements on the Web page uniquely, Selenium has provided support with the following locators 1. ID 2. ClassName 3. TagName 4. Name 5. LinkText 6. Partial LinkText 7. CSS Selector 8. XPath 1. ID ID may be generated dynamically, at that instant of time,this might fail driver.findElement(By.ID("IDValue")); 2. ClassName Multiple classes may have same ClassName, such as Radio buttons, Check boxes. So it might not be possible to identify an individual element uniquely. But when required to identify a group of elements, it will be useful driver.findElement(By.ClassName("Value")); 3. TagName Multiple Elements may have the same TagName, So it might not be possible to identify an individual element uniquely. But when required to identify a group of elements, it will be u...

Element Identification Techniques - XPath and CSS for absolute begginers

Element Location Strategies using XPath, CSS & DOM Automating any application requires identification of the element & interact with it Locator are used for identifying the elements on the web page uniquely. There are so many ways to identify the elements in Selenium and those are called locators. Some of the most used and popular locators are XPath & CSS What is XPath? How do we use XPath in Elements identification? XPath (XML Path Language),  is a query language for selecting nodes from an XML document. The XPath language is based on a tree representation of the XML document, and provides the ability to navigate around the tree, selecting nodes by a variety of criteria. XML contain one or more elements/tags/nodes An element may contain content/data or may contain other elements as child nodes. Each element should have starting tag and ending tag. The element content will reside in between these two tags. Apart from the content each tag  may have ...

QA's approach 2 Selenium Web Driver - Web Driver API Architecture

Image
Selenium Web Driver API Architecture: Webdriver doesn't help us running the Test cases nor doesn't it help us in reports generation/batch running/ordering the test case execution/excel file reading but it just helps us to interact with the browser using the webdriver commands “WebDriver”: Is an interface comes under this package of Selenium and a sub interface of “SearchContext”. “SearchContext” consists of “WebDriver” & “WebElement” as a sub interfaces. What is “GeckoDriver”: It is a WebDriver which is used to interact with WebApps. So, this means that all the drivers should have all the implementations which are contracted in the WebDriver interfaces and all the Drivers can be called as WebDriver. Web Page composed of Web Elements and these Drivers’s will communicate with the Web Page. For communicating with Web Page means communication with Elements present on the Web Page like for example: “Textboxes”, Buttons”, “Links” etc. “WebElement” a sub interface ...

QA's approach to CI - CI using Jenkins_ANT/MAVEN_TestNG

About Jenkins Branched from Hudson —Java based Continuous Build System Runs in servlet container Glassfish, Tomcat Supported by over 400 plugins SCM, Testing, Notifications, Reporting, Artifact Saving, Triggers, External Integration What can Jenkins do? Generate test reports —Integrate with many different Version Control Systems Push to various artifact repositories Deploys directly to production or test environments Notify stakeholders of build status java -jar WAR jenkins.war httpport=9090

QA's approach 2 Java - Working with Version Control

How to work with version control from Eclipse: 1. Once the Maven project is created - follow the steps from 2 To know about Step 1 click here 2. Now check in the project to Version control Launch Eclipse-> Select the project created in Step 1 ->Right click on the project ->Team->Share Project ->select SVN/GitHub 3. Once the connection was established & project was shared, if we make any changes then we need to commit the changes     Team-> commit 4. To download changes done by others to our local, we need to get the updated one, so      Team -> Update

Technologies - TestNG Framework - What & Why?

What is TestNG Its a New Generation Unit Testing framework, that is influenced by both JUnit and NUnit, but has more powerful features and is easier to use. It is designed with a good set of capabilities that simplify testing requirements ranging from functional, regression, end-to-end, and more Why testNG: 1. Support for annotations - Annotations in TestNG are lines of code that can control how the method below them will be executed. Annotations can use parameters just like the usual Java methods. 2. Support for parameterization - Static data using @Parameters 3. Support for Data Driven Testing using Data providers - Dynamic data   4. Enables user to set execution priorities & groups the test methods 5. Readily supports integration with various tools and plug-ins like build tools (Ant, Maven etc.), 6. Facilitates user with effective means of Report Generation using ReportNG.  WebDriver has no native mechanism for generating reports , So TestNG c...

QA's approach 2 Java - Build Tools - ANT

Image
Build Tools ANT abbreviates as Another Neat Tool Basically its a build management tool, which is used for Compiling the Code, Creating the Project Tree structure, etc based on the targets defined in Build.xml file Will only allow us to execute the framework from command prompt Ant uses an xml file for its configuration. The default file name is build.xml. Ant builds are based on three blocks: tasks, targets and extension points. How to declare variables in Build.xml file =============================== property element Ant uses the property element which allows us to specify properties. This allows the properties to be changed from one build to another, or from one environment to another. <?xml version="1.0"?> <project name="Test Project" default="notify"> <property name="Blogname" value="novice-2-professional.blogspot.com"/> <target name="notify"> <echo>Version ...

QA's approach 2 Java - Build Tools - Maven

Image
Build Management Tools  Maven Its a Build & Dependency management tool Maven POM is an acronym for Project Object Model. The pom.xml file contains information of project and configuration information for the maven to build the project such as dependencies, build directory, source directory, test source directory, plugin, goals etc. Maven reads the pom.xml file, then executes the goal. POM.xml This file will contain all the instruction which we wanted to do Maven reads instructions from POM.xml file  1. Verifies the resources 2. Compiles the tests 3. Package the test to jar file ======================================================================== <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId...