Selenium+TestNG реальные примеры
Подскажите как будет выглядеть данный код Junit переконвертированный в TestNG -
package com.example.tests;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
public class test1 {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new InternetExplorerDriver();
baseUrl = "http://server3/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testUntitled() throws Exception {
driver.get(baseUrl + "/BOSS/Login.aspx?browser=any ");
driver.get(baseUrl + "/BOSS/Login.aspx?browser=any ");
new Select(driver.findElement(By.id("ctl00_cphM_lgnBoss_ddlDts"))).selectByVisibleText("Tas_ap");
driver.findElement(By.id("ctl00_cphM_lgnBoss_UserName")).clear();
driver.findElement(By.id("ctl00_cphM_lgnBoss_UserName")).sendKeys("369532");
driver.findElement(By.id("ctl00_cphM_lgnBoss_Password")).clear();
driver.findElement(By.id("ctl00_cphM_lgnBoss_Password")).sendKeys("12345");
driver.findElement(By.id("ctl00_cphM_lgnBoss_btLgn")).sendKeys(" ");
driver.findElement(By.xpath("//*[@id='ctl00_mnuMainn1']/table/tbody/tr/td/a")).click();
driver.findElement(By.xpath("//*[@id='ctl00_mnuMainn3']/table/tbody/tr/td/a")).click();
driver.findElement(By.xpath("//*[@id='ctl00_mnuMainn4']/table/tbody/tr/td/a")).click();
driver.findElement(By.xpath("//*[@id='ctl00_mnuMainn5']/table/tbody/tr/td/a")).click();
driver.findElement(By.xpath("//*[@id='ctl00_mnuMainn6']/table/tbody/tr/td[1]/a")).click();
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
private boolean isElementPresent(By by) {
try {
driver.findElement(by);
return true;
} catch (NoSuchElementException e) {
return false;
}
}
}
Так же, если у кокго есть примеры тестов написанных на TestNG дайте пожалуста ознакомиться.