Back To Normal

Subscribe To Our E-Mail Newsletter

Showing posts with label Automation. Show all posts
Showing posts with label Automation. Show all posts

Friday, May 8, 2015

Selenium and Webdriver waits


Here, I have listed all waits methods which is used in selenium web driver. It's helpful to eliminate  the random failures from your test suites.

Implicit waits
Selenium execution will wait for a specified time period to load the DOM elements.After that it will check the presence of web elements in the DOM, if not then throw errors. 
 Example: driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS)

Explicit waits:
Selenium execution will wait for a specified time period to load the locator and it will check the condition every 500ms.
Wait  wait = new WebDriverWait(driver, 30);
WebElement element= wait.until(visibilityOfElementLocated(By.id(“locator")));

Web driver waits 
There is a default web driver waits to check the presence, visibility, clickable and invisible and it will check the condition every 500ms.
Wait  wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.invisibilityOfElementLocated(locator));
wait.until(ExpectedConditions.presenceOfElementLocated(locator));
wait.until(ExpectedConditions.elementToBeClickable(locator));
wait.until(ExpectedConditions.visibilityOfElementLocated(locator));

Fluent wait:
If you want to check the presence of the web element in a specific time interval for maximum limit.
  For Example: it waits until the element with id “100" is found. If the element is not found, retry every 5 seconds. But wait only up to a maximum of 60 seconds.
Wait wait = new FluentWait(driver) .withTimeout(60, SECONDS) .pollingEvery(5, SECONDS) .ignoring(NoSuchElementException.class); WebElement foo = wait.until(new Function() { public WebElement apply(WebDriver driver) { return driver.findElement(By.id("id100")); }

Wait for Ajax calls in capybara. This will helpful to wait until all ajax calls completion.
def wait_for_ajax count = Capybara.default_wait_time * 10 actual_count = 0 count.times do break if page.evaluate_script 'window._ajax_sent == window._ajax_completed' actual_count += 1 sleep 0.1 end fail 'wait_for_ajax timed out! Please check for javascript errors in the context of the test!' if actual_count>= count end
Read More


Saturday, March 7, 2015

Challenges in Webdriver Selenium

Web driver is a library which will allow the user to interact with the browser. Tester always thinks, it's a tool will qualify to automate entire component of web applications.
In general,web driver doesn’t have any libraries to automate all components of web applications.
    Common problems in test automation:
  • Windows objects like save,download,import,export dialog boxes.
  • Switching between windows
  • Web driver doesn’t automate Flash, silver light and charts.
  • Handling Popup/Dialog Windows
  • Handling Hidden objects 
  • Triggering event after setting values.
  • Object Repository or Page object model support.

Handling hidden object and triggering event after setting values.       

         If you are not able to click hidden element on page, then write java script to click the element in browser. I have faced similar issue in my project, after setting value in text box , its not triggering event. Due to that, test were randomly getting failed in CI. When test run in foreground then its getting passed or else failed.      
        I have tried to solve this problem in many ways , using tab keys ,enter keys but nothing worked out. Finally rewritten script in java script to focus out the element after setting values. To click any Hidden element  or event trigger , don’t depend on web driver library better write in java script.    

To click Hidden object      
 JavascriptExecutor js = (JavascriptExecutor)driver;  
 js.executeScript("arguments[0].click();", element);

Trigger event.      
  page.execute_script("$('table.list_price').focusout()”)

Windows objects like save,download,import,export dialog boxes  

        If you are developing and running scripts in windows, then use VBscript ,WSH and Autoit to handle dialog boxes in windows platform. For manipulating excel and handling text files, use VBscript handles.

Switching between windows   
Find details in my previous post: http://automationhints.blogspot.in/2012/05/how-to-identify-popup-window-in.html

Web driver doesn’t automate Flash, silver light and charts. 
 https://code.google.com/p/wipflash/ : Flash based applications
  http://teststack.net/White/ : silver light
  UI Automation : For all .net based applications  

Image comparison : http://www.imagemagick.org/

Object Repository or Page object model support.      
 Java based Framework : PageFactory      
 Ruby on rails : siteprism, capypage.

Read More


Saturday, December 6, 2014

Test Coverage

Test Coverage Symphony :
           In my three years of experience in symphony , we have tracked automation coverage by comparing automated test cases against manual test cases. Whenever my manager asks the report, features based automated test count shared with him. The manager always informs us, Test coverage should be more than 80% percentage.
    To achieve 80%, we have worked , since two to three years and automated nearly 10,000 test cases, which runs for four days  in five to six VMS.

In over all, test coverage is not worked out to certify the quality of application. It never going to helpful to achieve bug free application, and still customer facing problem of production defects.

Test Coverage Huawei :
         Huawei is process oriented company and they will follow customized agile (scrum & XP) .Huawei needs all kinds of test reports(Test Plan, Test cases, Test summary, RCA, Retrospective) to certify quality. All these test reports are maintained based on the iteration and release.

Test coverage perspective , we need to keep track of Integration tests should be more than 90%, and functional Test  should not be less than 80%. Agile coach will audit all teams and give rating based on process and document. If functional & Integration tests are less than 80%, then coach will declare that team as low performing.

           Its mostly forcing us to maintain all reports , irrespective of quality of application. In over all , they will measure quality of application based on process and test reports. I can see , still Huawei is struggling to get customer satisfaction ,to ensure the quality.

Test coverage in Thought-works.
       Thoughtworks is agile oriented company and they will never believe on test reports. They will always choose , TDD or BDD type of development.
First write your test and write your code to pass the test, it will push all tests into lower level and keep minimal number of tests in higher level.
       This way of working is totally new to me , they never write any manual test cases . There is no way of tracking test execution results , developer will automate all possible scenarios in Unit level and Integration level.
     
       Responsibility of Tester , he will review all tests with respective to story and if there is any uncovered scenarios, then he will add into respective levels.  With respective to test coverage , they will track Integration and unit Test coverage , but never compare automated test cases into manual tests case.
      If clients are asking any kind of test reports , then they will prepare minimal report or either convince client and explain test approaches to client.

  If you have time , please read this post ,

   



Read More


Tuesday, December 2, 2014

How to identify better automation tool for your project ?

In-general ,before identifying any automation tool,first ensure the requirements or automation scope of project. Which will helpful to identify right tool in shorter period of time. I have listed ,what are general parameters which need to be consider to identify tool..

Web Application Testing
  • To check the browser support (IE, Mozilla , chrome)
  • Version of browser is important during selection of tool
  •  Is there any available to intimate the page loading?
  • Can I wait to image or page to load ?
  • can i check the availability of objects like its enabled , visible, disabled  or contains…?
  • Can I extract data from web page like all or within methods
Framework design support  
  • Page Object Model or Object Mapping
  • Test/Error recovery
  • Support for Graphical User interface (Flex, Silverlight)
  • Operating system support (Linux, Mac, Windows)..
  • Third party components usage
  • Support (licensed or open source). If its open source then check community support.
  • Test Report and Parallel execution of script.
Database testing
        All application provide facility to keep data outside itself . This can be achieved through by introducing databases (oracle, db2 , postgres). All databases will use common query SQL  and use ODBC drivers to communicate databases. We need to check any available tool to execute or manipulate datas like store procedures.

Data
     1. How can we separate data from scripts  ?
     2. can you generate data automatically ?
     3. How can we keep seed or data dump updated always ?
     4. How can we randomize the access to data ?



Read More


Sunday, June 22, 2014

Set TestData By Using Active Record


1. Create gem file(under test directory ) and add active record , Postgres and database cleaner gems, it will helpful to maintain consistent version.




2. Create database.rb file under support directory




Read More


Monday, August 13, 2012

Java : Test Automation Questions and Answers

1. String Immutable
The absolutely most important reason that String is immutable is that it is used by the
class loading mechanism, and thus have profound and fundamental security aspects.

Had String been mutable, a request to load "java.io.Writer" could have been changed to load
"vijay.co.DiskErasingWriter"
Details: http://javarevisited.blogspot.in/2010/10/why-string-is-immutable-in-java.html

2. Two main mehod in single class

Ans : Its possible with different retun type and parameters (method overloading )
3. String Memory allocation vs StringBuffer vs String Builders

String sname ='vijay';

sname ='ragavan';
Details: http://javarevisited.blogspot.in/2011/07/string-vs-stringbuffer-vs-stringbuilder.html

5. Usage of Interface
Often interfaces are touted as an alternative to multiple class inheritance. While
interfaces may solve similar problems, interface and multiple class inheritance are quite
different animals, in particular:
A class inherits only constants from an interface.
A class cannot inherit method implementations from an interface.
The interface hierarchy is independent of the class hierarchy. Classes that implement the
same interface may or may not be related through the class hierarchy. This is not true for
multiple inheritance.

Usage of Interfaces :
You use an interface to define a protocol of behavior that can be implemented by any class
anywhere in the class hierarchy. Interfaces are useful for the following:
Capturing similarities between unrelated classes without artificially forcing a class relationship
Declaring methods that one or more classes are expected to implement
Revealing an object's programming interface without revealing its class. (Objects such as these are called anonymous objects and can be useful when shipping a package of classes to other developers.)
6. Garbage collector in java and usage.
Java takes a different approach; it handles deallocation for you automatically. The technique that accomplishes this is called garbage collection. It works like this: when no references to an object exist, that object is assumed to be no longer needed, and the memory occupied by the object can be reclaimed.
The finalize( ) Method
Sometimes an object will need to perform some action when it is destroyed. For example, if
an object is holding some non-Java resource such as a file handle or window character font,
then you might want to make sure these resources are freed before an object is destroyed

Keyword: System.gc();
Read More


Thursday, March 4, 2010

Define FrameWork and Types of Framework?

Framework may be designed as a set of abstract concepts, processes, procedures and environment in which automated tests will be designed, created and implemented.this framework definition includes the physical structures used for test creation and implementation, as well as the logical interactions among those components.

It is Classified as
  1. First Generation Frame work
      a. Linear Frame Work
  2. Second generation Framework(hybrid Framework)
      b.Functional Decomposition
      c.Data Driven Framework
  3.Third Generation Frame Work
      d.Key word Driven Framework
  4.Fourth Generation Frame Work
      e.Model Based Frame Work.

For Detail:
http://www.automatedtestinginstitute.com/home/index.php?option=com_content&view=article&id=69:frameworks-introduction&catid=91:frameworks-introduction&Itemid=75
Read More


560 Free Online Courses

Top 200 universities launched 500 free online courses.  Please find the list here .