前端網頁自動測試
如何使用 selenium 來測試網站
Jimmy
電影裡的駭客
真實世界的工程師
程式寫越多
通常Bug 就更多
測試 ?
現實生活中的測試方式
多Browser又怎麼測試
壓力測試 ?
我使用 Apache JMeter
But….
今天不談壓力測試
今天只談 UI 測試
如何做好品質管理?
請善用工具,做適當的測
試
進入主題
Selenium
Selenium is
● Browser base Web Application testing tool
● Open Source License
● Support Mobile Testing Android / IOS
● Wri...
Selenium
● Selenium Core
● Selenium IDE
● Selenium RC(Remote Control)
● Selenium WebDrivers
● Selenium Grid
Selenium IDE
S...
Selenium History
2004 年 :由Jason Huggins 為了 ThoughtWorks開發出來的
(Selenium core,IDE,RC)
2007 年 : Google 的Simon Stewart 發起 webD...
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
Sele...
Selenium IDE
● record
Demo
前端自動測試我知道二種
圖形比對
網頁內容操作比對
原本今天不是要講
Selenium
是要談 Sikuli
後來發現
Selenium
比我想像中的強
所以....
繼續看下去
Selenium WebDriver
● WebDriver is designed in a simpler and more
concise programming interface along with
addressing some ...
Selenium WebDriver
Selenium WebDriver support
AndroidDriver
ChromeDriver
EventFiringWebDriver
FirefoxDriver
HtmlUnitDriver
InternetExplorerDr...
Selenium WebDriver support
Java
C#
Python
Ruby
Perl
Javascript
Selenium WebDriver (以Java為例)
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http:...
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
navi...
Selenium Client Driver
There is a different client library for each supported language.
A Selenium client library provides...
Demo
心得
● 降低bug的產生,提高程式的品質
● 更熟悉流程的正確性
● 利用夜間排程,進行自動測試
Q / A
前端網頁自動測試
前端網頁自動測試
前端網頁自動測試
前端網頁自動測試
前端網頁自動測試
前端網頁自動測試
前端網頁自動測試
前端網頁自動測試
Upcoming SlideShare
Loading in...5
×

前端網頁自動測試

2,150

Published on

Selenium UI Test

Published in: Automotive, Technology
0 Comments
21 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,150
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
29
Comments
0
Likes
21
Embeds 0
No embeds

No notes for slide

前端網頁自動測試

  1. 1. 前端網頁自動測試 如何使用 selenium 來測試網站 Jimmy
  2. 2. 電影裡的駭客
  3. 3. 真實世界的工程師
  4. 4. 程式寫越多
  5. 5. 通常Bug 就更多
  6. 6. 測試 ?
  7. 7. 現實生活中的測試方式
  8. 8. 多Browser又怎麼測試
  9. 9. 壓力測試 ?
  10. 10. 我使用 Apache JMeter
  11. 11. But….
  12. 12. 今天不談壓力測試
  13. 13. 今天只談 UI 測試
  14. 14. 如何做好品質管理?
  15. 15. 請善用工具,做適當的測 試
  16. 16. 進入主題
  17. 17. Selenium
  18. 18. 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..
  19. 19. Selenium ● Selenium Core ● Selenium IDE ● Selenium RC(Remote Control) ● Selenium WebDrivers ● Selenium Grid Selenium IDE Selenium RC Selenium WebDrivers Selenium Grid
  20. 20. Selenium History 2004 年 :由Jason Huggins 為了 ThoughtWorks開發出來的 (Selenium core,IDE,RC) 2007 年 : Google 的Simon Stewart 發起 webDriver 2008 年:selenium 與 webDriver結合 (Selenium2)
  21. 21. Selenium IDE ● add-on for Mozilla Firefox ● record, edit, and debug tests ● recording the Script
  22. 22. Selenium IDE ● install (firefox 外掛) http://docs.seleniumhq.org/download/ Selenium IDE Selenium RC Selenium WebDrivers Selenium Grid
  23. 23. Selenium IDE ● record
  24. 24. Demo
  25. 25. 前端自動測試我知道二種
  26. 26. 圖形比對 網頁內容操作比對
  27. 27. 原本今天不是要講 Selenium
  28. 28. 是要談 Sikuli
  29. 29. 後來發現 Selenium 比我想像中的強
  30. 30. 所以....
  31. 31. 繼續看下去
  32. 32. 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
  33. 33. Selenium WebDriver
  34. 34. Selenium WebDriver support AndroidDriver ChromeDriver EventFiringWebDriver FirefoxDriver HtmlUnitDriver InternetExplorerDriver PhantomJSDriver RemoteWebDriver SafariDriver
  35. 35. Selenium WebDriver support Java C# Python Ruby Perl Javascript
  36. 36. 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(); ….略..... } }
  37. 37. Demo
  38. 38. Selenium RC Architecture Selenium IDE Selenium RC Selenium WebDrivers Selenium Grid
  39. 39. Selenium RC Architecture
  40. 40. Selenium Client Driver
  41. 41. 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
  42. 42. 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.
  43. 43. Demo
  44. 44. 心得 ● 降低bug的產生,提高程式的品質 ● 更熟悉流程的正確性 ● 利用夜間排程,進行自動測試
  45. 45. Q / A
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×