Posts

Showing posts from September, 2022

Pytest Tutorial - 5 | The Basics - How to write data-driven tests?

Image
So far we have understood how to write simple tests in pytests . We also saw pytest in action. In this tutorial we will now learn how to write data driven tests. What are data driven Tests? These are those tests, which tests a functionality using various scenarios mocked through a set of test data. In order to achieve this we pass the test data from external data sources such as csv/excel/yaml/json/database/etc. Now why do we need to pass test data from an external data source? Very simple reasons: If the test data is not passed through an external data source, then everytime we add/update/remove test data, we need to update our code. One test case can be tested using multiple combinations of data to test for various conditions of validation Example 1: you can test login using 2 types of test data   Valid credentials Invalid credentials      Example 2: you can also test password change functionality with 6 types of test data : (Minimum - 1) allowed length of passwo...

Pytest Tutorial - 4 | The Basics - Testing Concepts and Types

Image
  Why this in between pytest tutorials? Dear learners, I feel that knowing the basics of Test types and concepts behind it will help each one of us in the long run of writing robust, scalable, readable and impactful tests. Let’s dive in! There are multiple types of testing which are generally performed in various IT organizations. Unit tests Integration Tests System tests (Will explore on this in separate tutorials) System integration tests (Will explore on this in separate tutorials) Pytest can help in all the above. These types of testing are fine however, when it comes to testing, we have many test cases to automate/run, be it unit test or integration or system tests. In order to manage this we need to learn test management as well. Typically in test management we  Map our tests to requirements/user stories for test coverage purposes group our tests in TEST SUITES.  A test suite is a collection of tests. You can have multiple test suites such as unit test suite/integra...