Created by Howard.Zuo / @Howard.Zuo
A special software (separate from the software being tested) to be used controlling the execution of tests and the comparison of actual outcomes with predicted outcomes.
It covers some repetitive but necessary tasks in a formalized testing process already in place, or add additional testing that would be difficult to perform manually.
It is critical for continuous delivery and continuous testing.
It is a challenge for any company to continuously maintain and improve the quality and efficiency of software systems development.
Bug fix in working module, how will you ensure that the new bug fixes have not introduced any new bug in previous working functionality?
How will you simulate highly simultaneous interactions, have thousands tester interact with the website in same time?
With almost the same GUI but functional changes are more, challenge for your eyes!
With automation-testing, testers can now concentrate on more difficult test scenarios
Prerequisites
public class ChromeDriverTest {
private String testUrl;
private WebDriver driver;
@Before
public void prepare() {
//setup chromedriver
System.setProperty(
"webdriver.chrome.driver",
"webdriver/chromedriver");
testUrl = "http://leftstick.github.io/";
// Create a new instance of the Chrome driver
driver = new ChromeDriver();
//set window size
driver.manage().window().setSize(new Dimension(1300,1000));
// And now use this to visit myBlog
// Alternatively the same thing can be done like this
// driver.navigate().to(testUrl);
driver.get(testUrl);
}
@Test
public void testTitle() throws IOException {
// Find elements by attribute lang="READ_MORE_BTN"
List<WebElement> elements = driver
.findElements(By.cssSelector("[lang=\"READ_MORE_BTN\"]"));
//Click the selected button
elements.get(0).click();
assertTrue("The page title should be chagned as expected",
(new WebDriverWait(driver, 3))
.until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.getTitle().equals("以BDD手写依赖注入");
}
})
);
}
@After
public void teardown() throws IOException {
driver.quit();
}
}
Thanks for watching