
Why you should learn Tavern?
Explore api testing fundamentals with the tavern framework, practice on the tvm's api backend, and master endpoints, http methods, yaml structures, and data driven testing.
Brief walkthrough of the TVMaze free public API that will be used in the test project
basic knowledge of HTTP and the commonly used methods that will be encountered in the course project
where to reach me
Why would you choose tavern-ci over other solutions?
Structure of a test in tavern
We know how variables are used in programming lets see how they are used in tavern
One of the key concepts in tavern are the use of external functions for validating responses and injecting data into requests
the author of the library has decided to report $ext magic keyword in the response block as part of tavern 1.0. Use verify_response_with instead
Save the response body to an external JSON file using tavern, via a utilities save function that dumps response.json to a file for post-test inspection and artifact logging.
Learn data driven testing with tavern, using a YAML test suite and data source to run multiple data rows against Flask endpoints square and reverse, with input and output validation.
Explore strict key checking in Tavern with a Flask app example, showing how default true enforces full responses from the /user endpoint, while false allows focusing on id and name.
Learn how to define and reuse shared stages in tavern tests using a shared stages yaml file, including login and logout, ref syntax, and variable sharing.
Explore built-in parameter validators such as any int, any float, any str, any bool, any list, and any date to validate response types in api testing.
Explore built-in validators in Tavern, using the validate_regex helper to apply regex across JSON fields with JMS path, comparing prefix validators to prefix-style tests for username and email.
Install pytest and run first script
Learn the power of pytest fixtures and how it can help in writing logic for setup and teardown for your tests
Organize your test fixtures to a common file so it can be used by multiple modules at the same time
A useful pytest fixture which logs time every test takes
Explore multiple pytest run options: run all tests in a directory, a single module, or a specific test function, with verbosity and fixtures to reveal prints and metadata.
pytest-ordering allows you to control the run order of your tests
installing tavern-ci and running our first script
live coding of the first test case for the project
live coding of the second test case for the project
project refactoring
live coding of the third test case for the project
Test the shows endpoint pagination by confirming a maximum of 250 results per page and verifying the response list length.
Explore negative testing on the TV Maze shows endpoint by validating empty results for nonexistent shows and error details for invalid show IDs using Tavern's validate content helper.
use pytest html plugin to generate easily distributable test reports
adding delays between tests allows your backend to finish processing the request completely and close processes appropriately. This is useful to not overload the backend which can lead to a crash ultimately
lets add some logging to the project for how long each test takes
refactor project again to keep it clean
the terminal output can look very busy with the warning summary. Lets remove it
putting query parameters in URL can quickly get ugly and unmanageable so use the params key within your request body
cleaning DB resources is important before running your tests to make sure you dont run into DB constraints
cleaning DB resources is important before running your tests to make sure you dont run into DB constraints
using environment variables can help you avoid putting sensitive information in your code
https://github.com/i4ali/tvmazeapiautomation
Note: Use Coupon Code 5AEA172DF633864F8F64 at checkout for discount (Limited Time Only)
Welcome to the comprehensive course on Tavern, an underrated yet powerful API testing solution in Python. This course is designed to equip you with all the knowledge and skills you need to master API testing using Tavern.
What You’ll Learn:
Introduction to Tavern: Understand the fundamentals of Tavern and why it stands out as a robust API testing tool.
Setting Up Your Environment: Step-by-step guidance on setting up your development environment for efficient API testing.
Working with Public APIs: Engage in hands-on projects using real-world public APIs to solidify your understanding.
Creating and Managing Test Suites: Learn how to create, manage, and execute comprehensive test suites to ensure your APIs are functioning as expected.
Advanced Testing Techniques: Dive into advanced features and techniques to enhance your testing capabilities.
Community Support: Join a community of learners and professionals, sharing knowledge and experiences to enhance your learning journey.
By the end of this course, you’ll have a deep understanding of Tavern and be fully equipped to set up and manage an automation suite for your projects. Whether you’re a beginner or an experienced developer, this course will provide you with the tools and confidence to excel in API testing. Enroll now and take the first step towards mastering API testing with Tavern