File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ """ These tests demonstrate pytest marker use for finding and running tests.
2+
3+ Usage examples from this file:
4+ pytest -v -m marker_test_suite # Runs A, B, C, D
5+ pytest -v -m marker1 # Runs A
6+ pytest -v -m marker2 # Runs B, C
7+ pytest -v -m xkcd_code # Runs C
8+ pytest test_markers.py -v -m "not marker2" # Runs A, D
9+
10+ (The "-v" will display the names of tests as they run.)
11+ (Add "--collect-only" to display names of tests without running them.)
12+ """
13+
14+ import pytest
15+ from seleniumbase import BaseCase
16+
17+
18+ @pytest .mark .marker_test_suite
19+ class MarkerTestSuite (BaseCase ):
20+
21+ @pytest .mark .marker1
22+ def test_A (self ):
23+ self .open ("https://xkcd.com/1319/" )
24+ self .assert_text ("Automation" , "div#ctitle" )
25+
26+ @pytest .mark .marker2
27+ def test_B (self ):
28+ self .open ("https://www.xkcd.com/1700/" )
29+ self .assert_text ("New Bug" , "div#ctitle" )
30+
31+ @pytest .mark .marker2
32+ @pytest .mark .xkcd_code # Tests can have multiple markers
33+ def test_C (self ):
34+ self .open ("https://xkcd.com/844/" )
35+ self .assert_text ("Good Code" , "div#ctitle" )
36+
37+ def test_D (self ):
38+ self .open ("https://xkcd.com/2021/" )
39+ self .assert_text ("Software Development" , "div#ctitle" )
You can’t perform that action at this time.
0 commit comments