Professional Documents
Culture Documents
Kyle McEvoy
Director of QA
@_kmce
First conf talk! Thanks NTD!
Kyle McEvoy
Director of QA
√
@_kmce
We’re hiring!
fanduel.com/careers
What Python has to offer for test automation
What Python has to offer for test automation
skills
Your
Why Python? Why not X?
Python
Java
Python
1<5
s e rs
B ro w
s e rs
B ro w
N a tiv e
Apps
s e rs
B ro w
N a tiv e
Apps
A P Is
s e rs
B ro w
N a tiv e
Apps
A P Is
u t io n /C o n c u r r e n cy
Distrib
BDD
s e rs
B ro w
N a tiv e
Apps
A P Is
u t io n /C o n c u r r e n cy
Distrib
BDD
s e rs
B ro w
N a tiv e n g
Apps R e p o r t i
A P Is
u t io n /C o n c u r r e n cy
Distrib
Test Framework
BDD
s e rs
B ro w
N a tiv e n g
Apps R e p o r t i
A P Is
u t io n /C o n c u r r e n cy
Distrib
Popular test frameworks
test_file_example.py
JUnit
pytest
Basic pytest Test
test_file_example.py
Basic pytest Test
test_file_example.py
Basic pytest Test
test_file_example.py
“test_”
Installing pytest
Terminal
Installing pytest
Terminal
You PyPI
Installing pytest
You PyPI
Installing pytest
Terminal
Virtual Environments
Python Virtual Environments
Project1 Project2 Project3
test_file_example.py
Test result
Terminal
Basic pytest Test
test_file_example.py
Terminal Test result
pytest
● Test auto-discovery
pytest
● Test auto-discovery
● No boilerplate
pytest
● Test auto-discovery
● No boilerplate
● Detailed failure introspection
pytest
● Test auto-discovery
● No boilerplate
● Detailed failure introspection
● Simple modular test fixtures
VERIFY
EXERCISE VERIFY
SETUP EXERCISE VERIFY
SETUP EXERCISE VERIFY TEARDOW N
Test Function
imports
fixtures
test
conftest.py
test_usernames.py
conftest.py
test_usernames.py test_credit.py
Use case API Test
Methods
● Login
● Get my username
Test Setup Already created
● Give money ● Login
● Logout ● API Client SDK
● Data models
(e.g. User)
Methods under test Test Teardown ● Test user
● Get my username ● Logout
● Give money
conftest.py
test_usernames.py test_credit.py
conftest.py
test_usernames.py test_credit.py
conftest.py
test_usernames.py test_credit.py
test_credit.py
test_credit.py
pytest
● Test auto-discovery
● No boilerplate
● Detailed failure introspection
● Simple modular test fixtures
pytest
● Test auto-discovery
● No boilerplate
● Detailed failure introspection
● Simple modular test fixtures
● Great plugins & complimentary packages
Popular plugins & packages
test_file_example.py
Terminal
test_file_example.py
*n o t a re a l tw e e t
Use case
Use case Browser Test
Use case Browser Test
Test Teardown
● Close browser
Test Setup
● Create user user fixture
● Load browser
● Login as user
● Navigate to
Deposit Page
Test Teardown
● Close browser
Test Setup
● Create user user fixture
● Load browser selenium fixture
● Login as user
● Navigate to
Deposit Page
Test Teardown
● Close browser
Test Setup
● Create user user fixture
● Load browser selenium fixture
● Login as user logged_in_browser fixture
● Navigate to
Deposit Page
Test Teardown
● Close browser
Test Setup
● Create user user fixture
● Load browser selenium fixture
● Login as user logged_in_browser fixture
● Navigate to
deposit_page fixture
Deposit Page
Test Teardown
● Close browser
Test Setup
● Create user user fixture
● Load browser selenium fixture
● Login as user logged_in_browser fixture
● Navigate to
deposit_page fixture
Deposit Page
Test Teardown
● Close browser selenium fixture
pages/deposit_page.py
conftest.py
tests/test_deposit_page.py
tests/test_deposit_page.py
tests/test_deposit_page.py
tests/test_deposit_page.py
decorators.py
decorators.py
conftest.py
tests/test_deposit_page.py
tests/test_deposit_page.py
Client projects
Client projects API projects
Client projects API projects Services Projects
Client projects API projects Services Projects
Client projects API projects Services Projects
Common project c o n te s ts
us er s
s & mo
Common s e r v ic e re