40
探討 Web UI 自動化測試工具 Jimmy

探討Web ui自動化測試工具

  • Upload
    -

  • View
    638

  • Download
    3

Embed Size (px)

Citation preview

Page 1: 探討Web ui自動化測試工具

探討Web UI自動化測試工具 Jimmy

Page 2: 探討Web ui自動化測試工具

Agenda

Why UI TestSeleniumSikuli

Page 3: 探討Web ui自動化測試工具

Why UI Test

Page 4: 探討Web ui自動化測試工具
Page 5: 探討Web ui自動化測試工具

這麼多size 怎麼測

Page 6: 探討Web ui自動化測試工具

現實生活中的測試方式

Page 7: 探討Web ui自動化測試工具
Page 8: 探討Web ui自動化測試工具

程式寫越多

Page 9: 探討Web ui自動化測試工具

通常Bug 就更多

Page 10: 探討Web ui自動化測試工具

請善用工具,做適當的測試

Page 11: 探討Web ui自動化測試工具

後端工程師,可以寫unit test

Page 12: 探討Web ui自動化測試工具

身為前端工程師,也來了解一下UI的測試可以怎麼測

Page 13: 探討Web ui自動化測試工具

Selenium

Page 14: 探討Web ui自動化測試工具

Selenium is

● Browser base Web Application testing tool

● Open Source License● Support Mobile Testing Android

/ IOS● Write Test case using Language

of Java,C#,Python,Ruby..

Page 15: 探討Web ui自動化測試工具
Page 16: 探討Web ui自動化測試工具

Selenium

Page 17: 探討Web ui自動化測試工具

Selenium

● Selenium Core● Selenium IDE● Selenium RC(Remote Control)● Selenium WebDrivers● Selenium Grid

Selenium IDE

Selenium RC

Selenium WebDrivers

Selenium Grid

Page 18: 探討Web ui自動化測試工具

Selenium IDE

● add-on for Mozilla Firefox● record, edit, and debug tests● recording the Script

Page 19: 探討Web ui自動化測試工具

Live Demo

Page 20: 探討Web ui自動化測試工具

Selenium WebDriver• WebDriver is designed in a simpler and more concise programming

interface along with addressing some limitations in the Selenium-RC API.

• WebDriver is a compact Object Oriented API when compared to Selenium1.0

• It drives the browser much more effectively and over comes the limitations of Selenium 1.x which affected our functional test coverage, like the file upload or download, pop-ups and dialogs barrier

• WebDriver overcomes the limitation of Selenium Rc's Single Host origin policy

Page 21: 探討Web ui自動化測試工具

Web Driver

Page 22: 探討Web ui自動化測試工具

Selenium WebDriverAndroidDriverChromeDriverEventFiringWebDriverFirefoxDriverHtmlUnitDriverInternetExplorerDriverPhantomJSDriverRemoteWebDriverSafariDriver

Page 23: 探討Web ui自動化測試工具

Selenium WebDriver supportJava C#PythonRubyPerlJavascript

Page 24: 探討Web ui自動化測試工具

Selenium WebDriver (以Java為例) @Before

public void setUp() throws Exception {driver = new FirefoxDriver();baseUrl = "http://autotest.localhost.com/";driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

}

@Testpublic void testLogin() throws Exception {

driver.get(baseUrl + "/index.php");driver.findElement(By.id("username")).clear();driver.findElement(By.id("username")).sendKeys("jimmy");driver.findElement(By.id("password")).clear();

….略..... }

@After

public void tearDown() throws Exception { driver.quit();

….略.....}

}

Page 25: 探討Web ui自動化測試工具

Live Demo

Page 26: 探討Web ui自動化測試工具

Selenium RC Architecture

Page 27: 探討Web ui自動化測試工具

Selenium RC Architecture

Page 28: 探討Web ui自動化測試工具

Selenium Client Driver

Page 29: 探討Web ui自動化測試工具

Selenium RC Setuphttp://seleniumhq.org/download

Extract the ZIP file. Start a Command Prompt or a console window and navigate to where

the ZIP file was extracted.

Run the command java –jar selenium-server-standalone.jar

Page 30: 探討Web ui自動化測試工具

sikuli

Page 31: 探討Web ui自動化測試工具

Why is sikuli?

• GUI test• Automate use Script(Python)• can be used to automate Flash Objects/ Flash Websites• Using Sikuli we can automate desktop application

Page 32: 探討Web ui自動化測試工具

Sikuli IDE

Page 33: 探討Web ui自動化測試工具

Live Demo

Page 34: 探討Web ui自動化測試工具

Sikuli API

• GUI test• Automate use Script(Python)• can be used to automate Flash Objects/ Flash Websites• Using Sikuli we can automate desktop application

Page 35: 探討Web ui自動化測試工具

How sikuli work?

Page 36: 探討Web ui自動化測試工具

最新版本Bug 注意

Mac 10.10 有 bughttps://bugs.launchpad.net/sikuli/+bug/1362011

修正

http://www.sikulix.com/

Page 37: 探討Web ui自動化測試工具

Other

Page 38: 探討Web ui自動化測試工具

其它幾個UI Test

• iMacro 與 sikuli 類以,都是在 firefox 上錄製,再進行測試

• Watir (web application test in ruby)• 使用ruby

• Robot Framework• python base• 可以參考 http://www.tonylin.idv.tw/dokuwiki/doku.php/rf:rf

Page 39: 探討Web ui自動化測試工具

心得

• 好的自動測試可以降低bug的產生,提高程式的品質

• 更熟悉流程的正確性

• 利用夜間排程,進行自動測試

Page 40: 探討Web ui自動化測試工具

參考資料來源

1. http://www.tonylin.idv.tw/dokuwiki/doku.php/rf:rf2. http://blog.mykhailo.com/