Tuesday, 8 January 2013

Suite creation in Junit4

Suite creation in Junit4

First Test



package com;


import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.server.SeleniumServer;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;

public class FirstOne {
    
    private static SeleniumServer seleniumServer;
    private static Selenium selenium = new DefaultSelenium( "localhost",4444, "*chrome","http://www.google.com");
    
    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        seleniumServer = new SeleniumServer();
        seleniumServer.start();
        selenium.start();
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
          selenium.stop();
          seleniumServer.stop();
    }

    @Test
    public void Testing() throws Exception{
        selenium.open("/");
        selenium.waitForPageToLoad("6000");
        selenium.type("q", "search");
        selenium.click("btnG");
 }

}

No comments:

Post a Comment