Thursday, November 14, 2013

Setup Selendroid on Windows.

LINK TO DOWNLOAD THE FILE WITH PICTURES


System requirements to run selendroid testcase on Windows.
  1. 1.       Java sdk (minimum 1.6) is installed and JAVA_HOME is configured.
     
       
  1. Set the Environment path:Set proper Environment path for Java

  • Right Click on My Computer->Properties
  • Select Advanced system Settings
  • Click on Environment Variables
  1. 4.       Click on New : Enter the below Variables and save as shown in screenshot.

Variable name : JAVA_HOME  .Variable Value :C:\Program Files\Java\jdk1.6.0_26\ (This should be the path of JDK on the machine)

Variable name : PATH .Variable Value :% JAVA_HOME%bin;
  1. 5.       Latest Android-Sdk is installed

Download ANDROID_SDK  from http://developer.android.com/sdk/index.html


  1. 6.        ANDROID_HOME is set.
Variable name : ANDROID_HOME Variable Value : D:\InstalledSoftwares\ANDROID\
Variable name : PATH .Variable Value :%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;
  1. 7.       At least one Android virtual device must be existent or an Android hardware device must be plugged in to the computer.
Click on start->All programs->android SDK tools ->Launch avd manager
Wait for it to open

Click on new



Fill in AVD NAME: for eg: SAMSUNG GALAXY, select Existing device and any target from the dropdown and click on OK.

Android virtual device will be created.

Now you are ready to launch selendroid testcases on this AVD.

 LINK to download the same blog with pictures

Sunday, October 14, 2012

Install Jenkins on Tomcat

Hi All,

To install jenkins on tomcat server,

1.Download apache tomcat
2.Download jenkins.war
3.Copy jenkins.war in  apache-tomcat-*.0.**/webapps/ foler
4.Navigate to  http://localhost:8080/jenkins
5.You can see jenkins installed on Tomcat.

Thursday, October 4, 2012

Link to store the subversion credentials in jenkins

When we have configured master-slave connection,we need to store svn credentials in both master and slave .Link appears to enter the credentials on master for jobs which runs on master,but link doesn't appears for the jobs tied to slave.Hence ,Auhentication failed error appears and svn checkout cannot be done.

Below is the link which will help you to store the svn credentials on any jenkins .

If  your jenkins is on localhost:8080 then,



If you need to setup credentials on jenkins which is deployed on any webserver , then

http://machinename:port/jenkins/scm/SubversionSCM/enterCredential
 where port is webserver's port number

Wednesday, October 3, 2012

Calling a java class as ant target

Here is the way to do it

classname: is filename of java :Ex: AutomationFileSequence
 arg: Any arguments if required to run the class needs to be mentioned here.

<target name="run_PostData" >
  <java fork="false" failonerror="yes" classname="com.qa.automation.main.AutomationFileSequence" classpathref="classpath"> 
            <arg line="${basedir}/Automation_PostData.properties"/>
    <arg line="PostData"/>
            </java>
            </target>

Starting and stopping selenium server through ant

Here is the way to do it.

Start selenium hub:

<target name="startServerhub">
        <echo>Starting Selenium Server...</echo>
        <java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
            <arg line="-port ${selenium.port} -trustAllSSLcertificates"/>
            <arg line="-log log.txt"/>   
            <arg value="-role"/>
            <arg value="hub"/>
        </java>
    </target>

Start selenium RC:

<target name="startServerRC" depends="startServerhub">
        <echo>Starting Selenium Server...</echo>
        <java jar="${lib.dir}/selenium-server-standalone.jar" fork="true" spawn="true">
            <arg line="-port 5555"/>
            <arg line="-log log.txt"/>   
            <arg line="-firefoxProfileTemplate"/>
            <arg value="${lib.dir}/ff_profile"/>
            <arg line="-userExtensions"/>
                <arg value="${lib.dir}/user-extensions.js"/>
            <arg line="-role node"/>
            <arg line="-hub http://localhost:4444/grid/register "/>
            <!--<arg line="-maxSession 10"/>
            <arg line="-maxInstances=10"/>-->
        </java>
    </target>


Now ,save the targets in the file build.xml .navigate to the folder through cmd prompt and call



 ant startServerRC

which will internally call startServerhub,since startServerRC depends on startServerhub.



Stop selenium :

<target name="stop-selenium" description="stop selenium server">
        <echo>Stopping selenium server</echo>
        <get taskname="selenium-shutdown" dest="result.txt" ignoreerrors="true"
             src="http://localhost:${selenium.port}/selenium-server/driver/?cmd=shutDownSeleniumServer"/>
    </target>


To stop selenium, call  : ant stop-selenium.

Sample Ant Script for running targets parallel and sequential

Recently ,I faced a challenge for making one target which can run the entire suite with lot of module dependencies.This was resolved with the help of ant targets: sequential and parallel.


Requirement :
I need to run the following sequetially

1.compile target
2. run and run_psdata targets paralelly
3.run_PreData,run_DFPPulls,run_AdTechPulls.... parallelly
4.run_PostData,run_Sales parallely
5.run_Administration,run_E2EPartner360,..... parallelly
6.run_Alerts,run_CustomFields  parallelly
7.Stop selenium

Below is the code to do all the above steps sequentially


<target name="CItarget">    
        <sequential>
            <antcall target="compile"/>
            <parallel>
              <antcall target="run"/>
              <antcall target="run_PSDATA"/>
            </parallel>
             <parallel>
                <antcall target="run_PreData"/>
                <antcall target="run_DFPPulls"/>
                <antcall target="run_AdTechPulls"/>
                <antcall target="run_AppnexusPulls"/>
                <antcall target="run_FTPPulls"/>
                <antcall target="run_OASPulls"/>
                <antcall target="run_GDFPPulls"/>
                <antcall target="run_FreewheelPulls"/>
                <antcall target="run_ThirdPartyPulls"/>
            </parallel>
    <parallel>
        <antcall target="run_PostData"/>
        <antcall target="run_Sales"/>
    </parallel>
            <parallel>
                <antcall target="run_Administration"/>
                <antcall target="run_E2EPartner360"/>
                <antcall target="run_Finance"/>
                <antcall target="run_Loaders"/>
                <antcall target="run_Accounts"/>
                <antcall target="run_Adops"/>
            </parallel>
            <parallel>
                 <antcall target="run_Alerts"/>
                <antcall target="run_CustomFields"/>
            </parallel>
            <antcall target="stop-selenium"/>
       </sequential>
    </target>

Monday, March 5, 2012

Interview Questions for Automation Engineers

1.Access Modifiers of JAVA
2.Explain final finaly and finalize
3.real example for abstract and interface
4.Launch firefox driver using webdriver.
ans: (driver driver = new firefox driver();)selenium selenium = new default selenium(driver,siteurl.com);
5.how to handle file upload using webdriver:
ans:Autoit /Sikulo\i
6.which is the plugin in ie to find d locator
ans: developer tool
7. Major difference between selenium RC and selenium Webdriver?
ans:Single origin policy 
  1.  WebDriver works at the OS/browser level:For instance, command type works at the OS level rather than changing the value of the input elements with JavaScript
  2.  It drives the browser much more effectively and over comes the limitations of Selenium 1.x which affected our functional test coverage, like the file upload or download, pop-ups and dialogs barrier or self-signed certificates problems
  3. Selenium RC, It ‘injects’ JavaScript functions into the browser when the browser was loaded and then used its JavaScript to drive the AUT within the browser. WebDriver does not use this technique. Again, it drives the browser directly using the browser’s built in support for automation.WebDriver drives the tests natively with the browser and emulates the Human interaction with website. Implementation differs on each browser’s.
  4.  Selenium 2.0 will provide both Selenium 1.x and WebDriver APIs.
  5. WebDriver is the name of the key interface against which tests should be written, but there are 11 implementing classes, listed as below:
    AndroidDriver, AndroidWebDriver, ChromeDriver, EventFiringWebDriver, FirefoxDriver,
    HtmlUnitDriver, InternetExplorerDriver, IPhoneDriver, IPhoneSimulatorDriver, RemoteWebDriver, SafariDriver.
8.what is hashmap?
9.Explain OOPS concept
10.TestNG framework.(How to pass parameters to the test method)
11. why static keyword is used in main declaration?
12.what is difference between testng paralellism and selenium grid?
13.There is a script which types abc in a text box.When we run the script on firefox,it types abc with no pause,whereas if we run it on ie, it types a pauses types b pauses,types c and pauses.Y is it so?
ans: Using css instead of xpath might resolve the issue.
14. What are the challenges faced in IE?
ans:Lazy loading.
15.Scenario: Clicking on a button opens a pop up with no title or text ,just the locator of the popup exists.How do you wait for the popup to disappear?
ans:Wait for the text to be enabled on the main page.or check if the locator of the popup is still displayed on screen
16. Scenario: Above scenario how can you handle if multi threading  is implemented.
     if(any component on the mainpage is disabled due to popup){ //pop up is available
while(){
    waitforpopupto disappear
}
}

qs: thread1 is in while(),control is given by cpu to thread2 to execute something else.until control comes back, popup might have come and disappeared .So, thread1 goes to infinite loop.

What do we do in such situation?

17. Some testcases fails due to sync issue even after providing explicit and implicit waits? how can we resolve this issue?

18.How do we re-run testcases which failed only due to sync issue in testNG?

Asked below in Amazon Interview:
19.without using inbuilt function, find the index of 1 string in other string
20.find the number is square root or not and find the sq root of any given number
30.write testcases of above to test ur code

Please provide your thoughts as comments..