<Learning Selenium Testing Tools with Python>

  1. Selenium is a set of tools for automating browsers
  2. Selenium IDE: This is a Firefox add-in used to record and play back the Selenium scripts with Firefox.
  3. Selenium WebDriver: This is a programming interface for developing advanced Selenium scripts using programming languages.
  4. Installing the Seleniun package: pip install -U selenium
  5. The selenium.webdriver module implements the browser driver classes that are supported by Selenium, including Firefox, Chrome, Interne Explorer, Safari, and various other browsers, and RemoteWebDriver to test on browsers that are hosted on remote machines
  6. Test Fixture: By using a test fixture, we can define the prepartion needed to perform one or more tests and any associated clean-up actions
  7. Test Case: A test case is the smallest unit of testing in unittest. It checks for a specific response to a particular set of actions and inputs using various assert methods provided by the unitest library. The unittest library provides a base class called TestCase that may be used to create new test cases.
  8. Test Suite: A test suite is a collection of multiple tests or test cases to create groups of tests representing specific functionality or modules of the application under test, which will be executed together.
  9. The starting point for test cases is the setUp() method, which we can use to perform some tasks at the start of each test or all the tests that will be defined in the class. The method takes no arguments and doesn't return anything. When a setUp() method is defined, the test runner will run that method prior to each test method.
  10. For each test method that the test runner finds, it executes the setUp() method before executing the test method.
  11. How about sharing a single Firefox instance between the methods instead of creating a new instance every time? This can be done by using the setUpClass() and tearDownClass() methods and using the @classmethod decorator. These methods allow us to initialize values at the classes level instead of the method level and then share these values between hte test methods.
  12. Using the TestSuites feature of unittest, we can collect various tests into logical groups and then into a unified test suite that can be run with a single command
  13. Selenium provides various find_element_by methods to find elements on a web page. These methods search for an element based on the criteria supplied to them. If a matching element is found, an instance of WebElement is returned or the NoSuchElementException exception is thrown if Selenium is not able to find any element matching the search criteria
  14. To create a data-driven test we need to use the @ddt decorator for the test class and use the @data decorator on the data-driven test methods.
  15. The @data decorator takes as many arguments as we have values that we want to feed to the test.
  16. The page object pattern is making tests separate from low-level actions, and providing a high-level abstraction.
  17. The page object pattern offers creating an object representing each web page from the application under test. We can define classes for each page, modeling all attributes and actions for that page.
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 12,136评论 0 10
  • 何为缘,即是上辈子未偿的债。 缘,终究是命。命,只得由天。 都说命中注定,这事也注定,那事也管得,一切自有上天安排...
    佑卿剑阅读 1,703评论 0 0
  • 1.整体效果首先看下android5.0以上的转场动画用共享元素实现以及配合补间动画和圆形缩放动画实现的activ...
    这真不是玩笑阅读 13,205评论 2 14
  • 还没到最炎热的夏天,不知道它怎么就躺在地上再也飞不起来了。应该曾经飞在天空中的它有过幸福的回忆吧,生命真的很神奇,...
    娇之道阅读 3,365评论 0 0