1 / 17

Acceptance testing

Case Selenium. Acceptance testing. Summary. Acceptance testing What you should test? Robot Framework Selenium Syntax Xpath Command types Common commands Terms Features Demo Tips’n’tricks Selenium RS. Acceptance testing. vs. unit testing Acceptance testing = UI testing

latham
Download Presentation

Acceptance testing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Case Selenium Acceptance testing

  2. Summary • Acceptance testing • What you should test? • Robot Framework • Selenium • Syntax • Xpath • Command types • Common commands • Terms • Features • Demo • Tips’n’tricks • Selenium RS

  3. Acceptance testing • vs. unit testing • Acceptance testing = UI testing • Suunto requires us to write tests • Good • Suunto requires • use of Selenium • use of Robot Framework

  4. What you should test? • Test expected content • Test links • Test functions • Test dynamic elements • … • http://seleniumhq.org/docs/06_test_design_considerations.html#what-to-test

  5. Robot Framework • Environment to run Selenium tests • Automated • I know nothing of Robot Framework, but it must be cool

  6. Selenium • Selenium is a suite of automated tool for testing web application front end – UI test framework • Selenium emulates browser user • Selenium commands are like "write text "Panu" to input which id is "name"" • Selenium's language supports simple scripting (operators, defining variables) • Selenium supports multiple methods to locate elements • Element ID • Element name attribute • Xpath • DOM • CSS

  7. Xpath • XML query language • Features • Selecting nodes • by path • by predicates • with wildcards • Axes • Operators • Examples: • //div[@id='cartable']/table/tbody/tr/td[1] • //input[@value='Jatka'] • RTFM: http://www.w3schools.com/XPath/xpath_syntax.asp

  8. Selenium - syntax Syntax command                target                value eg. verifyTextPresent    id=phone        0700123123

  9. Selenium - command types • Actions are commands that generally manipulate the state of the application. They do things like “click this link” and “select that option”. If an Action fails, or has an error, the execution of the current test is stopped. • Accessors examine the state of the application and store the results in variables, e.g. “storeTitle”. They are also used to automatically generate Assertions. • Assertions are like Accessors, but they verify that the state of the application conforms to what is expected. Examples include “make sure the page title is X” and “verify that this checkbox is checked”.

  10. Selenium - terms Test are divided to  • Test suites • Test cases Test suites are built from test cases. Both test cases AND test suites should be parameterised.

  11. Selenium - Common commands open opens a page using a URL. click/clickAndWait performs a click operation, and optionally waits for a new page to load. verifyTitle/assertTitle verifies an expected page title. verifyTextPresent verifies expected text is somewhere on the page. verifyElementPresent verifies an expected UI element, as defined by its HTML tag, is present on the page. verifyText verifies expected text and it’s corresponding HTML tag are present on the page. verifyTable verifies a table’s expected contents. waitForPageToLoad pauses execution until an expected new page loads. Called automatically when clickAndWait is used. waitForElementPresent pauses execution until an expected UI element, as defined by its HTML tag, is present on the page.

  12. Selenium IDE • Firefox extension • Very easy to get to know Selenium and to play with it • Also supports recording and running test cases / suites • http://seleniumhq.org/download/ • Features • Recording tests, running tests, test cases, test suites, breakpoints, pausing execution, export as code

  13. Selenium IDE – Cheat sheet • B – set breakpoint • X – execute command • S – set starting point • Good for debugging!

  14. Demo • Test Samuli’s application • Transitions • Adding cars, parameters • Test constraints • List cars • Added cars are actually listened

  15. Selenium tips'n'tricks • DON’t trust Selenium IDE or it’s default Xpath! • You might have to change HTML code a bit to make it easier to test automatically, eg. Add id/name attributes • That’s completely OK! • “AndWait” commands wait until whole page has been loaded • Very useful, but they don’t work with Ajax • Difference between assert and verify • If asset fails => test stops • If verify fails => test continues • echo command is good for debugging

  16. Selenium RS • Selenium IDE has a poor support for programming, it does NOT support • condition statements • iteration • logging and reporting of test results • error handling, particularly unexpected errors • database testing • test case grouping • re-execution of failed tests • test case dependency • screenshot capture of test failures • Selenium RS supports adding programming logic to tests • .NET supported => though • I have no experience

  17. More? • http://seleniumhq.org/docs/index.html • http://code.google.com/p/robotframework/

More Related