pytest fixtures: explicit, modular, scalable

For the course ‘Real World Test Automation with Pytest (Django app)’ by Eden Marco, in the section fixtures, I decided to get an in-depth understanding of this subject and completed on pytest website tutorial called “pytest fixtures: explicit, modular, scalable”. o In this tutorial, I learned: • What fixtures are • Requesting fixtures • Fixtures can request other fixtures • Fixtures are reusable • A test/fixture can request more than one fixture at a time • Fixtures can be requested more than once per test (return values are cached) • Autouse fixtures (fixtures you don’t have to request) • Scope: sharing fixtures across classes, modules, packages or session • Fixture scopes • Dynamic scope • Fixture errors • Teardown/Cleanup - yield fixtures • Fixture availability • conftest.py: sharing fixtures across multiple files • Fixtures from third-party plugins • Fixture instantiation order • Higher-scoped fixtures are executed first • Fixtures of the same order execute based on dependencies • Autouse fixtures are executed first within their scope • Using markers to pass data to fixtures • Factories as fixtures • Parametrizing fixtures • Using marks with parametrized fixtures • Automatic grouping of tests by fixture instances • Use fixtures in classes and modules with usefixtures • Using fixtures from other projects You can find this tutorial at https://docs.pytest.org/en/6.2.x/fixture.html#pytest-fixtures-explicit-modular-scalable

Unittest Mocking

For the course ‘Real World Test Automation with Pytest (Django app)’ by Eden Marco, in the section mocking, I decided to take additional four tutorials on this subject to get in-depth understanding of this subject. Firstly, “Intro to Python Mocks | Python tutorial #1” by Red Eyed Coder Club on Youtube. The length of tutorial is 0:18 total hours. o In this tutorial, I learned: • ideal testable function, and a unit test for it • example of a function with a dependency on another function • a test for the function with a dependency on another function. Problems that Mocks will solve. • patch() function from unittest.mock • an example of unit test of a function that makes a request to external API and returns a different result each time it's been called. A mock returns another mock. How to test requests. Secondly, “Intro to Python Mocks #2: Mocking Exceptions | Python tutorial” by Red Eyed Coder Club on Youtube. The length of tutorial is 0:15 total hours. o In this tutorial, I learned: • Adding try/except block to the function under test • How to raise an exception from a test, and how to mock an exception using the .side_effect property. • Fixing the 'TypeError: catching classes that are not inherit from BaseException is not allowed' when mocking an exception. • Using the .raise_for_status() function from the requests library • Writing a test to test raise_for_status(), and mocking raise_for_status • Checking status codes within an except clause of the try/except block Thirdly, “Intro to Python Mocks #3: Mocking Python Requests with Responses | Python tutorial” by Red Eyed Coder Club on Youtube. The length of tutorial is 0:09 total hours. o In this tutorial, I learned: • Writing a test for a function that should return value if JSON object with a certain structure is provided. • Testing the raise_for_status() function with Python Responses library • Testing a logic when Exception is raised. You can find above three tutorials at Part 1: https://www.youtube.com/watch?v=xT4SV7AH3G8&t=4s&ab_channel=RedEyedCoderClub Part 2: https://www.youtube.com/watch?v=RqR0AvEujrU&t=2s&ab_channel=RedEyedCoderClub Part 3: https://www.youtube.com/watch?v=RNVspDHVIA0&t=1s&ab_channel=RedEyedCoderClub Fourthly, “How to use Python's unittest.mock.patch” by redshiftzero on Youtube. The length of tutorial is 0:08 total hours. o In this tutorial, I learned: • Three ways to use `mock.patch` as decorator, context_manager, and as inline • Patch keyword agruments - `return_value` and `side_effect` You can find this tutorial at https://www.youtube.com/watch?v=WFRljVPHrkE&t=303s&ab_channel=redshiftzero

GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker

For the course ‘Real World Test Automation with Pytest (Django app)’ by Eden Marco, in the section Continuous Integration, I decided to take an additional tutorial “GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker” by TechWorld with Nina. The length of the course is 0:32 total hours. o In the tutorial I learned: • What are GitHub Actions? • What are developer workflows? Use Cases for GitHub Actions • Basic Concepts of GitHub Actions: How GitHub Actions automates those workflows? GitHub Events & Actions • GitHub Actions CI/CD • Why another CI/CD Tool - Benefits of GitHub Actions • DEMO - Create CI Workflow or Pipeline • Syntax of Workflow File • Where does this Workflow Code run? GitHub Action Runner • Build Docker Image and push to private Docker Repo You can find this tutorial at https://www.youtube.com/watch?v=R8_veQiYBjI&ab_channel=TechWorldwithNana

Github Actions secrets

For the course ‘Real World Test Automation with Pytest (Django app)’ by Eden Marco, in the section Continuous Integration, I used GitHub secrets so I could use them in Actions. This allows me to always maintain my data secure by utilizing GitHub action secrets within my workflow. Handling GitHub action secrets is as easy as handling environment variables. This tutorial was created by Meroware Instance. The length of the tutorial is 0:08 total hours. You can find this tutorial at https://www.youtube.com/watch?v=WuWsg0Ldess&ab_channel=MerowareInstance

Git Fetch

For the course ‘Real World Test Automation with Pytest (Django app)’ by Eden Marco, in the section Continuous Integration, I created Actions and pipelines in GitHub and Bitbuckets respectively. However, my local repository was not synchronized with the remote repository. Therefore, I learned how to use the 'git fetch' command to synchronize files between remote and local repositories. The 'git fetch' command downloads commits, files, and refs from a remote repository into your local repo. Fetching is what you do when you want to see what everybody else has been working on. You can find this tutorial at https://www.atlassian.com/git/tutorials/syncing/git-fetch

1 2 3 4 ... 13

Our Sidebar

You can put any information here you'd like.

  • Latest Posts
  • Announcements
  • Calendars
  • etc