Saturday, November 20, 2010

Java platform

Watch this video..Link

Integration of soapUI tests in maven build lifecycle

We can include soapUI tests in SVN and run these tests as part of continuous integration testing.

We can use below tools to achieve this.

soapUI:         Webservices testing tool.
SVN:             Version control system.
Maven:         Build tool
Continuum:   Continuous integration server

Here is the link

Functional Web Services Testing Made Easy with SoapUI

Today, I read about Web Services Testing article on this website. LINK

Tuesday, November 16, 2010

How to setup Selenium Grid on Cloud MAC Server.

Here are the steps

1. Install VMWare Fusion on MAC server.
2. Load various OS/Browser VM's onto MAC SERVER
3. Create scripts to start and stop VM's from OS/X
4. Install Selenium Grid on MAC server
5. Create scripts to start and stop GRID.
6. Setup Selenium RC's on VM's and include RC's in the startup and run RC's on background.
7. Commands to Stop/Start GRID and VM's

Step1:

Download VMWare fusion from http://www.vmware.com/products/fusion/


Step2:

Create various OS/Browser VM's and Zip it and transfer onto MAC server

You can skip this step if MAC sever is located in your premises. You can transfer VM file using external hard driver or USB drive

For zipping use below command
gzip filename

A compressed file with extension .gz will be created.

To transfer the file to the MAC server use below command

navigate to the directory where file is located. Then enter below command

sftp macServerusername@macServerIP

it ask for password, enter the password, then “sftp<” promt will display.

Then enter below command

put filename

once transfer is completed, unzip the file. Use below command
gunzip filename


Step3: Create scripts to start and stop VM's from OS/X

Create a shell script  to start all VM's .

#!/bin/sh
cd /
cd Library/Application\ Support/VMware\ Fusion/

./vmrun -T ws start "/Users/test/ Vista IE7.vmwarevm"
./vmrun -T ws start "/Users/test/ Vista IE8-FF36.vmwarevm"
./vmrun -T ws start "/Users/test/ XP IE6.vmwarevm"
./vmrun -T ws start "/Users/test/ XP IE7.vmwarevm"
./vmrun -T ws start "/Users/test/ XP IE8-FF36.vmwarevm"


Create a shell script  to stop all VM's .

#!/bin/sh
cd /
cd Library/Application\ Support/VMware\ Fusion/

./vmrun -T ws stop "/Users/test/ Vista IE7.vmwarevm"
./vmrun -T ws stop "/Users/test/ Vista IE8-FF36.vmwarevm"
./vmrun -T ws stop "/Users/test/ XP IE6.vmwarevm"
./vmrun -T ws stop "/Users/test/ XP IE7.vmwarevm"
./vmrun -T ws stop "/Users/test/ XP IE8-FF36.vmwarevm"


Step 4: Install Selenium Grid on MAC server


Selenium Grid setup instructions are available on selenium site (http://selenium-grid.seleniumhq.org/get_started.html)


If java JDK is not setup, setup by including path in the system variables. Setup ANT path.


Go at the root of selenium grid directory and validate your installation:
$ cd selenium-grid-1.0
$ ant launch-hub
 
Step 5:Create scripts to start and stop GRID.
Shell script to start GRID
$ cd selenium-grid-1.0
$ ant launch-hub
Shell script to stop GRID
curl -d action=shutdown http://localhost:4444/lifecycle-manager

Step 6:Setup Selenium RC's on VM's and include RC's in the startup and run RC's on background.


Create Batch script to individual RC on VM's

Here is the sample Batch script (.bat)

cd C:\selenium-grid-1.0.8

ant -Dport=5590 -Dhost=1.2.3.4 -DhubURL=http://2.3.4.5:4448 -Denvironment="Firefox on Windows" -DseleniumArgs="-firefoxProfileTemplate \"C:\Users\test\AppData\Roaming\Mozilla\Firefox\Profiles\nlw66qbe.default"\" launch-remote-control


Step7: Create VBS script to run RC in the background. Give the RC batch file path in the VBS script.

Set WshShell = WScript.CreateObject("WScript.Shell")
obj = WshShell.Run("C:\GRID-RC.bat", 0)
set WshShell = Nothing


Include VBS file in the startup.

Sunday, November 14, 2010

Selenium Framework1 : Selenium IDE,RC,ANT,TestNG, Eclipse IDE

Architecture:
Using this framework we can run tests from command line or from eclipse IDE.
This framework uses Selenium IDE,RC,ANT,TestNG, Eclipse IDE.

Selenium IDE: selenium IDE used to record a testcase, exporting it into Java.
Selenium RC:Converted test case in java can be executed using selenium RC. 
TestNG: tesNG is used for configuration and report results.
ANT: This build tool is to execute tests from command line.

Setup:

1. Install JDK. Here is the link to install JDK.
2. Install ANT. Here is the link to install Ant.
3. Install Eclipse. Here is the link.
4. Install testNG Eclipse plug-in ..Link
 
5.open the eclipse.exe file and create a workspace and a project.
Select the path where you want ur project files needs to be stored.














  

6. Create a project
    File-->New--> Java project

Give the project name and  select first radio in the project layout,then click next.
Once project is created, project name will display in the left side package explorer.

Now create four packages with names "framework", "test", "lib","Conf".
right click on project, select new--> package. then enter the package name.

a) Framework package is for Baseclass and other common methods.
b) tests - It contains all tests
c) lib - It contains all library files
d) Conf - It contains configurtion file( xml file ) to execute the tests.

7. Download following jar files and copy to the "Lib" folder.
    a) testng  jar link
    b) Selenium server jar - Download RC
    c) Selenium java cleint driver - link
    d) log4j jar - link

 8. after copying above jar files in the lib folder, right click on project and click on properties.
Now, add all four files to the buildpath.
9.  right click on framework , select New--> class. give the class name as BaseTest.
   once basetest.java file created, copy code from this link.

10. right click on tests, select New--> class. give the class name as test1.
   once test1.java file created, copy code from this link
11. right click on conf, select New--> file. give the class name as AC-run.xml.
   once AC-run.xml file created, copy code from this link
12. right click on project, select New--> file. give the class name as build.xml.
   once build.xml file created, copy code from this link.

After all above steps are completed, structure should look like below.
13. Now we are good to execute tests from conf file.
     right click on AC-run.xml file and select Run as--> TestNG Suite
   14. testNG result will display as below
      
15. Html output will be stored in the "test-output" as below
   

AC-run.xml

<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd">
<suite name="regression test">

<parameter name="baseurl" value="www.google.com"/>

<parameter name="hostname" value="localhost" />
<parameter name="browser" value="*firefox" />

<test name="regression test">

    <classes>   
       
        <class name="tests.test1"> </class>
       
    </classes>     
   
</test>

</suite>

test1

package tests;

import com.thoughtworks.selenium.*;

import org.testng.annotations.*;
import org.testng.internal.thread.TestNGThread;
import framework.BaseTest;


public class test1 extends BaseTest {

    @Test public void test() throws Exception {

        selenium.open("https://members.kaiserpermanente.org/kpweb/signon.do");
        selenium.windowMaximize();
        selenium.windowFocus();
        TestNGThread.sleep(3000);
    //    selenium.waitForPageToLoad("30000");
        assertTrue(selenium.isElementPresent("//div[@id='brand']/img"));
        assertTrue(selenium.isElementPresent("userid"));
        assertTrue(selenium.isElementPresent("password"));
        selenium.type("password", "jhkjh");
    }
}