Skip to content

Commit a361531

Browse files
pytest concept pratice
1 parent 57b762d commit a361531

7 files changed

+35
-2
lines changed

PythonSelenium/ChromeOptions.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# Maximize screen mood
1313
chrome_options.add_argument("--start-maximized")
1414

15-
16-
1715
# Chrome browser invoke by driver through manually
1816
service_obj = Service("C:\\Users\\Proshanta\\Desktop\\PythonAutomation\\driver\\chromedriver.exe")
1917
driver = webdriver.Chrome(service=service_obj, options=chrome_options)

pytestAutomation/__init__.py

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.

pytestAutomation/test_Practice1.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Any pytest file should start with test_ or end with _test
2+
# pytest method name should start with test
3+
# Any codee should be wrapped in method only
4+
# In pytest we can't declare method name same, if declare then it will override the previous method
5+
# CMD for run all TC py.test -v -s
6+
# CMD for run specific file py.test test_Practice1.py -v -s
7+
# - k stands for method names execution, -s logs in output, -v stands for more metadata
8+
# Run any specific method on a file ---> py.test -k test_firstProgram -v -s
9+
# we can mark(tag) test @pytest.mark.some and then run with -m
10+
# pytest.mark.xfail is used for not to show pass or failed status in reports
11+
12+
import pytest
13+
14+
15+
@pytest.mark.xfail
16+
def test_firstProgram():
17+
print("Hello 1")
18+
19+
20+
@pytest.mark.skip
21+
def test_secondProgram():
22+
print("Hello 2")

pytestAutomation/test_Practice2.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pytest
2+
3+
4+
def test_userProgram():
5+
msg = "Hello"
6+
assert msg == "Hi", "Test is failed as strings not matched!"
7+
8+
9+
@pytest.mark.smoke
10+
def test_creditProgram():
11+
a = 4
12+
b = 6
13+
assert a + 2 == 6, "Addition not matched."

0 commit comments

Comments
 (0)