前端網頁自動測試
Upcoming SlideShare
Loading in...5
×
 

前端網頁自動測試

on

  • 1,465 views

Selenium UI Test

Selenium UI Test

Statistics

Views

Total Views
1,465
Views on SlideShare
1,439
Embed Views
26

Actions

Likes
18
Downloads
18
Comments
0

2 Embeds 26

http://www.slideee.com 25
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

前端網頁自動測試 前端網頁自動測試 Presentation Transcript

  • 前端網頁自動測試 如何使用 selenium 來測試網站 Jimmy
  • 電影裡的駭客
  • 真實世界的工程師 View slide
  • 程式寫越多 View slide
  • 通常Bug 就更多
  • 測試 ?
  • 現實生活中的測試方式
  • 多Browser又怎麼測試
  • 壓力測試 ?
  • 我使用 Apache JMeter
  • But….
  • 今天不談壓力測試
  • 今天只談 UI 測試
  • 如何做好品質管理?
  • 請善用工具,做適當的測 試
  • 進入主題
  • Selenium
  • 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..
  • Selenium ● Selenium Core ● Selenium IDE ● Selenium RC(Remote Control) ● Selenium WebDrivers ● Selenium Grid Selenium IDE Selenium RC Selenium WebDrivers Selenium Grid
  • Selenium History 2004 年 :由Jason Huggins 為了 ThoughtWorks開發出來的 (Selenium core,IDE,RC) 2007 年 : Google 的Simon Stewart 發起 webDriver 2008 年:selenium 與 webDriver結合 (Selenium2)
  • Selenium IDE ● add-on for Mozilla Firefox ● record, edit, and debug tests ● recording the Script
  • Selenium IDE ● install (firefox 外掛) http://docs.seleniumhq.org/download/ Selenium IDE Selenium RC Selenium WebDrivers Selenium Grid
  • Selenium IDE ● record
  • Demo
  • 前端自動測試我知道二種
  • 圖形比對 網頁內容操作比對
  • 原本今天不是要講 Selenium
  • 是要談 Sikuli
  • 後來發現 Selenium 比我想像中的強
  • 所以....
  • 繼續看下去
  • 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 Selenium IDE Selenium RC Selenium WebDrivers Selenium Grid
  • Selenium WebDriver
  • Selenium WebDriver support AndroidDriver ChromeDriver EventFiringWebDriver FirefoxDriver HtmlUnitDriver InternetExplorerDriver PhantomJSDriver RemoteWebDriver SafariDriver
  • Selenium WebDriver support Java C# Python Ruby Perl Javascript
  • Selenium WebDriver (以Java為例) @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://autotest.localhost.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public 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(); ….略..... } }
  • Demo
  • Selenium RC Architecture Selenium IDE Selenium RC Selenium WebDrivers Selenium Grid
  • Selenium RC Architecture
  • Selenium Client Driver
  • Selenium RC Setup http://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
  • Selenium Client Driver There is a different client library for each supported language. A Selenium client library provides a programming interface (API), i.e., a set of functions, which run Selenium commands from your own program. The client libraries provide the programming support that allows you to run Selenium commands.
  • Demo
  • 心得 ● 降低bug的產生,提高程式的品質 ● 更熟悉流程的正確性 ● 利用夜間排程,進行自動測試
  • Q / A