Thursday, 7 November 2013

Automation in Java (One of my Projects)



        /**
         * @param args
         */
            import java.util.concurrent.TimeUnit;
            import org.junit.*;
            import static org.junit.Assert.*;
            import org.openqa.selenium.*;
            import org.openqa.selenium.firefox.FirefoxDriver;

            public class Airport_Regression {
              private WebDriver driver;
              private String baseUrl;
              private StringBuffer verificationErrors = new StringBuffer();

              @Before
              public void setUp() throws Exception {
                driver = new FirefoxDriver();
                driver.manage ().window ().maximize ();
//            This link should display blackbushe airport url //
                baseUrl = "http://cms-uat.blackbusheairport.co.uk/";
                driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
              }

              @Test
              public void testAirportRegression() throws Exception {
                driver.get(baseUrl + "/");
//                This link should display blackbushe airport homepage for users//
                driver.findElement(By.linkText("Home")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport Accomodation links for users//       
                driver.findElement(By.id("ctl00_MainContent_ctl00_QuickLinksAccomodationAnchor")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport Transport links for users//       
                driver.findElement(By.linkText("Transport")).click();
                Thread.sleep(10000);
//            This link should display lists of Transport links for users like Taxis//
                driver.findElement(By.id("ctl00_MainContent_ctl01_QuickLinksTransportAnchor")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport Charges for users//
                driver.findElement(By.id("ctl00_MainContent_ctl01_QuickLinksChargesAnchor")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport list of flying schools for users//
                driver.findElement(By.id("ctl00_MainContent_ctl01_QuickLinksFlyingSchoolAnchor")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport Cafe for users//
                driver.findElement(By.id("ctl00_MainContent_ctl01_QuickLinksBusheCafeAnchor")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport parking space for users//
                driver.findElement(By.id("ctl00_MainContent_ctl01_QuickLinksParkingAnchor")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport information for visitors//
                driver.findElement(By.linkText("Visit")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport information for int'l visitors for users//
                driver.findElement(By.linkText("International Visitors")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport Cafe for users//
                driver.findElement(By.linkText("The Bushe Cafe")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport facilities for users//
                driver.findElement(By.linkText("Airport Facilities")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport direction for users//
                driver.findElement(By.linkText("Directions")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport tourist information links for users//
                driver.findElement(By.linkText("Tourist Information")).click();
                Thread.sleep(10000);
//            All the links should display blackbushe airport links for users to navigate through the site//
                driver.findElement(By.linkText("Accomodation")).click();
                Thread.sleep(10000);
                driver.findElement(By.linkText("Transport")).click();
                Thread.sleep(10000);
//            This link should display information about blackbushe airport for users//
                driver.findElement(By.linkText("About")).click();
                Thread.sleep(10000);
//            This link should display contact details for blackbushe airport to users//
                driver.findElement(By.linkText("Contact Us")).click();
                Thread.sleep(10000);
//            This link should display Information on TV & Films shot on blackbushe airport to users//
                driver.findElement(By.linkText("TV & Film")).click();
                Thread.sleep(1000);
//            This link should display information on Air charters to users//
                driver.findElement(By.linkText("Air Charters")).click();
                Thread.sleep(10000);
//            This link should display information on flying schools to users//
                driver.findElement(By.linkText("Flying Schools")).click();
                Thread.sleep(10000);
//            This link should display history about blackbushe airport to users//
                driver.findElement(By.linkText("History")).click();
                Thread.sleep(10000);
//            This link should display information about blackbushe airport to users// 
                driver.findElement(By.linkText("Information")).click();
                Thread.sleep(10000);
//            This link should display details about blackbushe airport to users//
                driver.findElement(By.linkText("BCA Airport")).click();
                Thread.sleep(10000);
//            This link should display a layout of EGLK Airfield blackbushe airport to users//
                driver.findElement(By.linkText("EGLK Airfield Layout")).click();
                Thread.sleep(10000);
//            This link should display details about Noise and Circuit to users//
                driver.findElement(By.linkText("Noise and Circuit")).click();
                Thread.sleep(10000);
//            This link should display information about Hampshire Police to users//
                driver.findElement(By.linkText("Hampshire Police")).click();
                Thread.sleep(1000);
//            This link should display details about Weather report to users//
                driver.findElement(By.linkText("Weather Links")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport T&C's to users//
                driver.findElement(By.linkText("Terms and Conditions")).click();
                Thread.sleep(1000);
//            This link should display information about NOTAMs to users//
                driver.findElement(By.linkText("NOTAMs")).click();
                Thread.sleep(10000);
//            This link should display information on Airport Charges to users//
                driver.findElement(By.linkText("Airport Charges")).click();
                Thread.sleep(10000);
//            This link should display other links to users//
                driver.findElement(By.linkText("Links")).click();
                Thread.sleep(10000);
//            This link should display information on places of Attractions to users//
                driver.findElement(By.linkText("Attractions")).click();
                Thread.sleep(10000);
//            This link should display flying schools information to users//
                driver.findElement(By.linkText("Flying Schools")).click();
                Thread.sleep(10000);
//            This link should display information about Golf Course to users//
                driver.findElement(By.linkText("Golf")).click();
                Thread.sleep(10000);
//            This link should display information about Restaurants to users//
                driver.findElement(By.linkText("Restaurants")).click();
                Thread.sleep(10000);
//            This link should display information about Theme Parks to users//
                driver.findElement(By.linkText("Theme Parks")).click();
                Thread.sleep(10000);
//            This link should display Tourist Information to users//
                driver.findElement(By.linkText("Tourist Information")).click();
                Thread.sleep(10000);
//            This link should display more details about Transport to users//
                driver.findElement(By.linkText("Transport")).click();
                Thread.sleep(10000);
//            This link should display details of Sister Companies of Airport to users//
                driver.findElement(By.linkText("Sister Companies")).click();
                Thread.sleep(10000);
//            This link should display Airport Contact Details to users//
                driver.findElement(By.linkText("Contact us")).click();
                Thread.sleep(10000);
//            This link should display blackbushe airport Operation Hours to users//
                driver.findElement(By.linkText("Operation Hours")).click();
                Thread.sleep(10000);
              }

              @After
              public void tearDown() throws Exception {
                driver.quit();
                String verificationErrorString = verificationErrors.toString();
                if (!"".equals(verificationErrorString)) {
                  fail(verificationErrorString);
                }
              }
       

            // TODO Auto-generated method stub


        // TODO Auto-generated method stub

    }

No comments:

Post a Comment