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.

你可能感兴趣的:()