Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Test parametrization #1257

Answered by mdmintz
jirikralik asked this question in Q&A
Discussion options

What is the correct way to parametrize tests? In the examples, I found @parameterized.expand, however I am not able to identify the specific test case with pytest (pytest myFile.py::MyClass:theTest). I also tried to use @pytest.mark.parametrize from pytest, but it wont recognize the arguments in the test (probably due to the BaseTest class?)

You must be logged in to vote

Hi @jirikralik Here are two examples to take a look at:

https://github.com/seleniumbase/SeleniumBase/blob/master/examples/parameterized_test.py

https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_pytest_parametrize.py

They each use a different syntax format of SeleniumBase. For the first, which uses BaseCase inheritance, you need to use the parameterized library. The second uses @pytest.mark.parametrize because that works in combination with the sb pytest fixture.

Replies: 1 comment

Comment options

Hi @jirikralik Here are two examples to take a look at:

https://github.com/seleniumbase/SeleniumBase/blob/master/examples/parameterized_test.py

https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_pytest_parametrize.py

They each use a different syntax format of SeleniumBase. For the first, which uses BaseCase inheritance, you need to use the parameterized library. The second uses @pytest.mark.parametrize because that works in combination with the sb pytest fixture.

You must be logged in to vote
0 replies
Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /