Skip to content

Commit 08fada4

Browse files
committed
Update example tests
1 parent 3459aa9 commit 08fada4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

examples/test_repeat_tests.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
""" Tests to demonstrate how to repeat the same test multiple times.
2+
The 1st example uses the "parameterized" library.
3+
The 2nd example uses "pytest.mark.parametrize()". (NO class)
4+
The 3rd example uses "pytest.mark.parametrize()". (in class) """
5+
6+
import pytest
7+
from parameterized import parameterized
8+
from seleniumbase import BaseCase
9+
10+
11+
class RepeatTests(BaseCase):
12+
@parameterized.expand([[]] * 2)
13+
def test_repeat_this_test_with_parameterized(self):
14+
self.open("https://seleniumbase.io")
15+
self.click('a[href="help_docs/method_summary/"]')
16+
self.assert_text("API Reference", "h1")
17+
18+
19+
@pytest.mark.parametrize("", [[]] * 2)
20+
def test_repeat_this_test_with_pytest_parametrize(sb):
21+
sb.open("https://seleniumbase.io")
22+
sb.click('a[href="seleniumbase/console_scripts/ReadMe/"]')
23+
sb.assert_text("Console Scripts", "h1")
24+
25+
26+
class RepeatTestsWithPytest():
27+
@pytest.mark.parametrize("", [[]] * 2)
28+
def test_repeat_test_with_pytest_parametrize(self, sb):
29+
sb.open("https://seleniumbase.io")
30+
sb.click('a[href="help_docs/customizing_test_runs/"]')
31+
sb.assert_text("Command Line Options", "h1")

0 commit comments

Comments
 (0)