Simplify parameterized testing with matrix combinations of diverse test parameters
Project description
vedro-matrix
vedro-matrix
is a Python package that extends the vedro
framework, enabling parameterized testing with matrix combinations. It simplifies the process of creating and managing multiple test scenarios, especially when dealing with combinations of different test parameters like browsers, screen resolutions, user types, etc.
Installation
Install vedro-matrix
using pip:
$ pip install vedro-matrix
Usage
To use vedro-matrix
, import the params_matrix
decorator from the package and apply it to your test scenarios in a vedro
test suite.
Example
Here is an example of how to use vedro-matrix
to test a web page's rendering on different browsers and resolutions:
import vedro
from vedro_matrix import params_matrix
class Scenario(vedro.Scenario):
subject = "Open /about page ({browser}, {resolution})"
@params_matrix(
["chrome", "firefox"],
["1024x720", "1920x1080"],
)
def __init__(self, browser, resolution):
self.browser = browser
self.resolution = resolution
def when_user_opens_page(self):
self.page = open_about_page(self.browser, self.resolution)
def then_it_should_show_main_content(self):
assert self.page.main_content.is_visible()
This script will generate and run 4 separate test scenarios:
- Open /about page (chrome, 1024x720)
- Open /about page (chrome, 1920x1080)
- Open /about page (firefox, 1024x720)
- Open /about page (firefox, 1920x1080)
Running Tests
Run the scenarios using the vedro
command:
$ vedro run
You should see an output similar to the following, indicating that all scenarios have passed:
Scenarios
*
✔ Open /about page (chrome, 1024x720)
✔ Open /about page (chrome, 1920x1080)
✔ Open /about page (firefox, 1024x720)
✔ Open /about page (firefox, 1920x1080)
# --seed 79b84f2d-e98c-47bf-b057-acdf597c4143
# 4 scenarios, 4 passed, 0 failed, 0 skipped (1.51s)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for vedro_matrix-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4d29b7059a4e7676417ca0433c789d691bb64ee06b3fe97a8d3c216bc948cfd |
|
MD5 | 8abcc9d97b6d10481d5c6d59c421dd53 |
|
BLAKE2b-256 | 44b4aad4c35fcc74f2dc247e114195ad7c073eb6534c0d6214764bb18a9d3a53 |