Posts

Showing posts with the label fixtures
Image
A framework (based on python) that makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. Why do we need Pytest ? why selenium is not enough ? Selenium performs an action in the browser. But how we'll create a test to assert our case ? How we’ll run test suite (a bunch of test cases ) ? That's right... we need PyTest... Build our code structure (Fixtures) Create Test Suites Test Runners Provide Assertions Let's not waste time and start coding… Create Folder My_tests Create python file test_utils 1 def twice(x): 2 return x * 2 3 4 5 def thrice(x): 6 return x * 3   Code conventions: Files start (or end) with: test_ Methods start with: test_ Class starts with: Test_ Install PyTest: Install: pip install -U pytest Verify correct version: pytest --version How to tun PyTest ? Note : When you run  pytest , by default, it will look for tests in all directories and files below the current directory. We would...