전 세계에 걸쳐 테스트를 처음 사용합니다. 나는 테스트를 기록하기 위해 셀레늄 IDE를 사용하고있다. 또한 JUnit4 테스트 케이스로 테스트 케이스를 내보냈습니다. 내 내보내기 형식은 다음과 같습니다.셀레늄 IDE가 테스트 케이스를 내 보냈습니다
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.support.ui.Select;
public class Test {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://192.168.8.207/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void test() throws Exception {
driver.get(baseUrl + "/");
driver.findElement(By.name("user")).clear();
driver.findElement(By.name("user")).sendKeys("admin");
driver.findElement(By.name("password")).clear();
driver.findElement(By.name("password")).sendKeys("infineta123");
driver.findElement(By.id("btnLogin-button")).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;
}
}
}
이 테스트 케이스는 어떻게 실행합니까? 이제 그 후에 여러 테스트 케이스의 실행을 자동화 할 수 있습니까? 이 페이지에서