前端網頁自動測試

  • 1,506 views
Uploaded on

Selenium UI Test

Selenium UI Test

More in: Automotive , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,506
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
18
Comments
0
Likes
18

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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