SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Automation tests accelerating examples
Indonesia PhilippinesMalaysia ThailandSingapore Vietnam
Igor Lyubin
1
Automation tests accelerating examples
Indonesia PhilippinesMalaysia ThailandSingapore Vietnam
Igor Lyubin
1
About me
2
# Igor Lyubin
# PhD in Physics
# In QA since 2007
# Senior QA in Lazada
# http://blog.auto-testing.ru/post-550
Lazada
3
# Founded in 2012
# Biggest e-commerce in Asia
# 6 countries
# 650M users
# 40M products
# 1,2M products per day
Lazada
4
# 4 TechHub: VN, SG, TH, RU
# 600 IT engineers
# GoLang, PHP, Python
# Docker, Kubernetes
# https://www.slideshare.net/VLDCORP/kubernetes-76514226
My project
5
# Order API
# 1,5K tests
# Releases every day
# 2 showroom -> 6 staging -> live
# Testing should be fast < 10 minutes
Tests accelerating
6
# Precondition
# Prepare your stuff before
# Speed vs Coverage
# Get more resources
# Make slow fast
# UI Testing
# Hand Helper
# https://www.slideshare.net/alimenkou/how-to-make-your-functional-tests-really-quick
# https://www.slideshare.net/VLDCORP/sqa15 - Badoo
Precondition
7
Set the goal!
8
# Stay in plank while regression testing go
Fix flaky tests
9
# https://wiki.jenkins.io/display/JENKINS/Flaky+Test+Handler+Plugin
# https://www.joecolantonio.com/2015/12/21/top-10-reasons-for-flaky-automated-tests
py.test –-count=100 tests/
Prepare your
stuff before
10
?
11
def test_ok_filter_return_orders_by_ra_number(self):
return_order = db.get_random_return_orders()
ra_number = return_order['ra_number']
...
def test_ok_filter_return_orders_with_return_date(self):
return_order = db.get_random_return_orders()
date = return_order['return_date']
...
Cache data via session scope
12
def test_ok_filter_return_orders_by_ra_number(self):
return_order = db.get_random_return_orders()
ra_number = return_order['ra_number']
...
@pytest.fixture(scope='session')
def return_orders():
return db.get_return_orders(100)
@pytest.fixture
def random_return_order(return_orders):
return random.choice(return_orders)
def test_ok_filter_return_orders_by_ra_number(self, random_return_order):
ra_number = random_return_order['ra_number']
...
Define fixtures for readonly tests
13
# For readonly tests: statistics, filters, get
@pytest.fixture(scope='session')
def session_order():
return create_order()
# For action tests: return order, cancel order
@pytest.fixture
def order():
return create_order()
QA API
14
Coverage vs
Speed
15
?
@pytest.mark.parametrize('status', ['active', 'inactive', 'deleted'])
def test_ok_get_payment_method_by_status(self, status):
response = api.get_payment_method_by_status(status)
...
16
List to random
@pytest.mark.parametrize('status', ['active', 'inactive', 'deleted'])
def test_ok_get_payment_method_by_status(self, status):
response = api.get_payment_method_by_status(status)
...
statuses = ['active', 'inactive', 'deleted']
def test_ok_get_payment_method_by_status(self):
status = random.choice(statuses)
response = api.get_payment_method_by_status(status)
...
17
Split tests on groups
18
# 1 priority – killer feature
# 2 priority - good coverage
# 3 priority – work and ok
?
19
class TestGetCancelOrderQuestions:
def test_ok_get_questions(self):
api.get_cancel_order_questions()
class TestCreateCancelOrderQuestion:
def test_ok_create_question(self, request):
question = api.set_cancel_order_question(request)
questions = api.get_cancel_order_questions()
assert_that(questions[-1], equal_to(request))
...
Combine getter + setter as feature
20
class TestGetCancelOrderQuestions:
def test_ok_list_of_questions(self):
api.get_cancel_order_questions()
class TestCreateCancelOrderQuestion:
def test_ok_create_question(self, request):
question = api.set_cancel_order_question(request)
questions = api.get_cancel_order_questions()
assert_that(questions[-1], equal_to(request))
...
?
21
def test_ok_create_return_order(self, request):
response = api.create_return_order(request)
data = api.get_return_order_by_id(response.id_return_order)
assert_that(data, equal_to(request))
def test_400_create_return_order_twice(self, request):
api.create_return_order(request)
response = api.create_return_order(request)
assert_that(response.status_code, equal_to(400))
Combine ok + twice
22
def test_ok_create_return_order(self, request):
response = api.create_return_order(request)
data = api.get_return_order_by_id(response.id_return_order)
assert_that(data, equal_to(request))
def test_400_create_return_order_twice(self, request):
api.create_return_order(request)
response = api.create_return_order(request)
assert_that(response.status_code, equal_to(400))
Get more
resources
23
Parallelism by classes
24
# Nunit:
[assembly: Parallelizable(ParallelScope.Fixtures)]
# pytest-xdist 1.20:
# https://github.com/pytest-dev/pytest-xdist/pull/191
py.test -v --dist=loadscope
Parallelization on CI
25
Make slow fast
26
Mock
27
@pytest.fixture(scope='session')
def hello_pay_mock():
create_hello_pay_mock()
use_hello_pay_mock()
def test_ok_make_payment_with_hello_pay(self, hello_pay_mock):
...
# http://www.mbtest.org - mountebank
# https://github.com/aholyoke/mountebank-python
Response time SLA
28
@sla(300)
def order_items_by_id(json):
return post('order-items/by-id', json)
@sla(500)
def order_statistics_by_ip(json):
return post('order-statistics/by-ip', json)
# utils/measure_time.py
def sla(milliseconds):
def func_decorator(func):
def func_wrapper(*args):
r = measure_time(lambda: func(*args))
assert_that(r.time, less_than(milliseconds)
return r.result
return func_wrapper
return func_decorator
DB queries vs API requests
29
def test_ok_create_cancel_order_reason(self, request):
response = api.create_cancel_order_reason(request)
data = db.get_cancel_order_reason_by_id(response.id)
assert_that(response, equal_to(data))
def test_ok_create_cancel_order_reason(self, request):
response = api.create_cancel_order_reason(request)
data = api.get_cancel_order_reason_by_id(response.id)
assert_that(response, equal_to(data))
UI Testing
30
Only functional tests
31
# Create
# Read
# Update
# Delete
Direct navigation
32
def test_ok_create_cancel_order_reason(self, reason_data):
app.create_cancel_order_reason(reason_data)
reason = app.get_cancel_order_reason_by_name(reason_data.name)
assert_that(reason, equal_to(reason_data))
def create_create_cancel_order_reason(reason_data):
open_cancel_order_reason_page()
...
Direct asserts in api
33
def test_ok_create_cancel_order_reason(self, reason_data):
app.create_cancel_order_reason(reason_data)
reason = app.get_cancel_order_reason_by_name(reason_data.name)
assert_that(reason, equal_to(reason_data))
def test_ok_create_cancel_order_reason(self, reason_data):
app.create_cancel_order_reason(reason_data)
reason = api.get_cancel_order_reason_by_name(reason_data.name)
assert_that(reason, equal_to(reason_data))
?
34
driver.find_element_by_xpath('//*[contains(@class, "header__links-bar")]')
?
35
driver.find_element_by_xpath('//*[contains(@class, "header__links-bar")]')
driver.find_element_by_xpath('//div[contains(@class, "header__links-bar")]')
Do not use x-path locators
36
driver.find_element_by_xpath('//*[contains(@class, "header__links-bar")]')
driver.find_element_by_xpath('//div[contains(@class, "header__links-bar")]')
driver.find_element_by_id('links-bar-id')
Hand Helper
37
HandHelper
38# https://www.youtube.com/watch?v=Pbe5fK8ksEI
igor.lyubin@lazada.com
https://goo.gl/p17WQF
39

Weitere ähnliche Inhalte

Ähnlich wie QA Fest 2017. Игорь Любин. Примеры ускорения автотестов

Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...Learnosity
 
Angular Intermediate
Angular IntermediateAngular Intermediate
Angular IntermediateLinkMe Srl
 
Unit tests in node.js
Unit tests in node.jsUnit tests in node.js
Unit tests in node.jsRotem Tamir
 
Multiplication and division of calabash tests
Multiplication and division of calabash testsMultiplication and division of calabash tests
Multiplication and division of calabash testsRajdeep Varma
 
Apigility & Restfull APIs
Apigility & Restfull APIsApigility & Restfull APIs
Apigility & Restfull APIsYonni Mendes
 
JCD 2013 OCM Java Developer
JCD 2013 OCM Java DeveloperJCD 2013 OCM Java Developer
JCD 2013 OCM Java Developer益裕 張
 
OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式CodeData
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passageErik Rose
 
Using Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App EngineUsing Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App EngineRiver of Talent
 
Hitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingHitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingWiebe Elsinga
 
unit test in node js - test cases in node
unit test in node js - test cases in nodeunit test in node js - test cases in node
unit test in node js - test cases in nodeGoa App
 
Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023Scott Keck-Warren
 
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmUseful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmAnton Shapin
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock FrameworkEugene Dvorkin
 
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic
 

Ähnlich wie QA Fest 2017. Игорь Любин. Примеры ускорения автотестов (20)

Practical Celery
Practical CeleryPractical Celery
Practical Celery
 
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
Educate 2017: Customizing Assessments: Why extending the APIs is easier than ...
 
Angular Intermediate
Angular IntermediateAngular Intermediate
Angular Intermediate
 
Unit tests in node.js
Unit tests in node.jsUnit tests in node.js
Unit tests in node.js
 
Multiplication and division of calabash tests
Multiplication and division of calabash testsMultiplication and division of calabash tests
Multiplication and division of calabash tests
 
Apigility & Restfull APIs
Apigility & Restfull APIsApigility & Restfull APIs
Apigility & Restfull APIs
 
JCD 2013 OCM Java Developer
JCD 2013 OCM Java DeveloperJCD 2013 OCM Java Developer
JCD 2013 OCM Java Developer
 
OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式OCM Java 開發人員認證與設計模式
OCM Java 開發人員認證與設計模式
 
Django’s nasal passage
Django’s nasal passageDjango’s nasal passage
Django’s nasal passage
 
Using Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App EngineUsing Task Queues and D3.js to build an analytics product on App Engine
Using Task Queues and D3.js to build an analytics product on App Engine
 
Django tricks (2)
Django tricks (2)Django tricks (2)
Django tricks (2)
 
Hitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional TestingHitchhiker's guide to Functional Testing
Hitchhiker's guide to Functional Testing
 
unit test in node js - test cases in node
unit test in node js - test cases in nodeunit test in node js - test cases in node
unit test in node js - test cases in node
 
Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023Static Code Analysis PHP[tek] 2023
Static Code Analysis PHP[tek] 2023
 
Useful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvmUseful practices of creation automatic tests by using cucumber jvm
Useful practices of creation automatic tests by using cucumber jvm
 
Browser testing with nightwatch.js
Browser testing with nightwatch.jsBrowser testing with nightwatch.js
Browser testing with nightwatch.js
 
PyUIA 0.3
PyUIA 0.3PyUIA 0.3
PyUIA 0.3
 
TDD & BDD
TDD & BDDTDD & BDD
TDD & BDD
 
Unit testing with Spock Framework
Unit testing with Spock FrameworkUnit testing with Spock Framework
Unit testing with Spock Framework
 
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
Dusan Lukic Magento 2 Integration Tests Meet Magento Serbia 2016
 

Mehr von QAFest

QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилин
QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилинQA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилин
QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилинQAFest
 
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The FutureQA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The FutureQAFest
 
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...QAFest
 
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...QAFest
 
QA Fest 2019. Никита Галкин. Как зарабатывать больше
QA Fest 2019. Никита Галкин. Как зарабатывать большеQA Fest 2019. Никита Галкин. Как зарабатывать больше
QA Fest 2019. Никита Галкин. Как зарабатывать большеQAFest
 
QA Fest 2019. Сергей Пирогов. Why everything is spoiled
QA Fest 2019. Сергей Пирогов. Why everything is spoiledQA Fest 2019. Сергей Пирогов. Why everything is spoiled
QA Fest 2019. Сергей Пирогов. Why everything is spoiledQAFest
 
QA Fest 2019. Сергей Новик. Между мотивацией и выгоранием
QA Fest 2019. Сергей Новик. Между мотивацией и выгораниемQA Fest 2019. Сергей Новик. Между мотивацией и выгоранием
QA Fest 2019. Сергей Новик. Между мотивацией и выгораниемQAFest
 
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...QAFest
 
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...QAFest
 
QA Fest 2019. Иван Крутов. Bulletproof Selenium Cluster
QA Fest 2019. Иван Крутов. Bulletproof Selenium ClusterQA Fest 2019. Иван Крутов. Bulletproof Selenium Cluster
QA Fest 2019. Иван Крутов. Bulletproof Selenium ClusterQAFest
 
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...QAFest
 
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...QAFest
 
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automation
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automationQA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automation
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automationQAFest
 
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...QAFest
 
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...QAFest
 
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях IT
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях ITQA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях IT
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях ITQAFest
 
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложении
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложенииQA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложении
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложенииQAFest
 
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...QAFest
 
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...QAFest
 
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22QAFest
 

Mehr von QAFest (20)

QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилин
QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилинQA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилин
QA Fest 2019. Сергій Короленко. Топ веб вразливостей за 40 хвилин
 
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The FutureQA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
QA Fest 2019. Анна Чернышова. Self-healing test automation 2.0. The Future
 
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...
QA Fest 2019. Doug Sillars. It's just too Slow: Testing Mobile application pe...
 
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...
QA Fest 2019. Катерина Спринсян. Параллельное покрытие автотестами и другие и...
 
QA Fest 2019. Никита Галкин. Как зарабатывать больше
QA Fest 2019. Никита Галкин. Как зарабатывать большеQA Fest 2019. Никита Галкин. Как зарабатывать больше
QA Fest 2019. Никита Галкин. Как зарабатывать больше
 
QA Fest 2019. Сергей Пирогов. Why everything is spoiled
QA Fest 2019. Сергей Пирогов. Why everything is spoiledQA Fest 2019. Сергей Пирогов. Why everything is spoiled
QA Fest 2019. Сергей Пирогов. Why everything is spoiled
 
QA Fest 2019. Сергей Новик. Между мотивацией и выгоранием
QA Fest 2019. Сергей Новик. Между мотивацией и выгораниемQA Fest 2019. Сергей Новик. Между мотивацией и выгоранием
QA Fest 2019. Сергей Новик. Между мотивацией и выгоранием
 
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...
QA Fest 2019. Владимир Никонов. Код Шредингера или зачем и как мы тестируем н...
 
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...
QA Fest 2019. Владимир Трандафилов. GUI automation of WEB application with SV...
 
QA Fest 2019. Иван Крутов. Bulletproof Selenium Cluster
QA Fest 2019. Иван Крутов. Bulletproof Selenium ClusterQA Fest 2019. Иван Крутов. Bulletproof Selenium Cluster
QA Fest 2019. Иван Крутов. Bulletproof Selenium Cluster
 
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...
QA Fest 2019. Николай Мижигурский. Миссия /*не*/выполнима: гуманитарий собесе...
 
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...
QA Fest 2019. Володимир Стиран. Чим раніше – тим вигідніше, але ніколи не піз...
 
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automation
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automationQA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automation
QA Fest 2019. Дмитрий Прокопук. Mocks and network tricks in UI automation
 
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...
QA Fest 2019. Екатерина Дядечко. Тестирование медицинского софта — вызовы и в...
 
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...
QA Fest 2019. Катерина Черникова. Tune your P’s: the pop-art of keeping testa...
 
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях IT
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях ITQA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях IT
QA Fest 2019. Алиса Бойко. Какнезапутаться в коммуникативных сетях IT
 
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложении
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложенииQA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложении
QA Fest 2019. Святослав Логин. Как найти уязвимости в мобильном приложении
 
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...
QA Fest 2019. Катерина Шепелєва та Інна Оснач. Що українцям потрібно знати пр...
 
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...
QA Fest 2019. Антон Серпутько. Нагрузочное тестирование распределенных асинхр...
 
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22
QA Fest 2019. Петр Тарасенко. QA Hackathon - The Cookbook 22
 

Kürzlich hochgeladen

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 

Kürzlich hochgeladen (20)

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

QA Fest 2017. Игорь Любин. Примеры ускорения автотестов

  • 1. Automation tests accelerating examples Indonesia PhilippinesMalaysia ThailandSingapore Vietnam Igor Lyubin 1 Automation tests accelerating examples Indonesia PhilippinesMalaysia ThailandSingapore Vietnam Igor Lyubin 1
  • 2. About me 2 # Igor Lyubin # PhD in Physics # In QA since 2007 # Senior QA in Lazada # http://blog.auto-testing.ru/post-550
  • 3. Lazada 3 # Founded in 2012 # Biggest e-commerce in Asia # 6 countries # 650M users # 40M products # 1,2M products per day
  • 4. Lazada 4 # 4 TechHub: VN, SG, TH, RU # 600 IT engineers # GoLang, PHP, Python # Docker, Kubernetes # https://www.slideshare.net/VLDCORP/kubernetes-76514226
  • 5. My project 5 # Order API # 1,5K tests # Releases every day # 2 showroom -> 6 staging -> live # Testing should be fast < 10 minutes
  • 6. Tests accelerating 6 # Precondition # Prepare your stuff before # Speed vs Coverage # Get more resources # Make slow fast # UI Testing # Hand Helper # https://www.slideshare.net/alimenkou/how-to-make-your-functional-tests-really-quick # https://www.slideshare.net/VLDCORP/sqa15 - Badoo
  • 8. Set the goal! 8 # Stay in plank while regression testing go
  • 9. Fix flaky tests 9 # https://wiki.jenkins.io/display/JENKINS/Flaky+Test+Handler+Plugin # https://www.joecolantonio.com/2015/12/21/top-10-reasons-for-flaky-automated-tests py.test –-count=100 tests/
  • 11. ? 11 def test_ok_filter_return_orders_by_ra_number(self): return_order = db.get_random_return_orders() ra_number = return_order['ra_number'] ... def test_ok_filter_return_orders_with_return_date(self): return_order = db.get_random_return_orders() date = return_order['return_date'] ...
  • 12. Cache data via session scope 12 def test_ok_filter_return_orders_by_ra_number(self): return_order = db.get_random_return_orders() ra_number = return_order['ra_number'] ... @pytest.fixture(scope='session') def return_orders(): return db.get_return_orders(100) @pytest.fixture def random_return_order(return_orders): return random.choice(return_orders) def test_ok_filter_return_orders_by_ra_number(self, random_return_order): ra_number = random_return_order['ra_number'] ...
  • 13. Define fixtures for readonly tests 13 # For readonly tests: statistics, filters, get @pytest.fixture(scope='session') def session_order(): return create_order() # For action tests: return order, cancel order @pytest.fixture def order(): return create_order()
  • 16. ? @pytest.mark.parametrize('status', ['active', 'inactive', 'deleted']) def test_ok_get_payment_method_by_status(self, status): response = api.get_payment_method_by_status(status) ... 16
  • 17. List to random @pytest.mark.parametrize('status', ['active', 'inactive', 'deleted']) def test_ok_get_payment_method_by_status(self, status): response = api.get_payment_method_by_status(status) ... statuses = ['active', 'inactive', 'deleted'] def test_ok_get_payment_method_by_status(self): status = random.choice(statuses) response = api.get_payment_method_by_status(status) ... 17
  • 18. Split tests on groups 18 # 1 priority – killer feature # 2 priority - good coverage # 3 priority – work and ok
  • 19. ? 19 class TestGetCancelOrderQuestions: def test_ok_get_questions(self): api.get_cancel_order_questions() class TestCreateCancelOrderQuestion: def test_ok_create_question(self, request): question = api.set_cancel_order_question(request) questions = api.get_cancel_order_questions() assert_that(questions[-1], equal_to(request)) ...
  • 20. Combine getter + setter as feature 20 class TestGetCancelOrderQuestions: def test_ok_list_of_questions(self): api.get_cancel_order_questions() class TestCreateCancelOrderQuestion: def test_ok_create_question(self, request): question = api.set_cancel_order_question(request) questions = api.get_cancel_order_questions() assert_that(questions[-1], equal_to(request)) ...
  • 21. ? 21 def test_ok_create_return_order(self, request): response = api.create_return_order(request) data = api.get_return_order_by_id(response.id_return_order) assert_that(data, equal_to(request)) def test_400_create_return_order_twice(self, request): api.create_return_order(request) response = api.create_return_order(request) assert_that(response.status_code, equal_to(400))
  • 22. Combine ok + twice 22 def test_ok_create_return_order(self, request): response = api.create_return_order(request) data = api.get_return_order_by_id(response.id_return_order) assert_that(data, equal_to(request)) def test_400_create_return_order_twice(self, request): api.create_return_order(request) response = api.create_return_order(request) assert_that(response.status_code, equal_to(400))
  • 24. Parallelism by classes 24 # Nunit: [assembly: Parallelizable(ParallelScope.Fixtures)] # pytest-xdist 1.20: # https://github.com/pytest-dev/pytest-xdist/pull/191 py.test -v --dist=loadscope
  • 27. Mock 27 @pytest.fixture(scope='session') def hello_pay_mock(): create_hello_pay_mock() use_hello_pay_mock() def test_ok_make_payment_with_hello_pay(self, hello_pay_mock): ... # http://www.mbtest.org - mountebank # https://github.com/aholyoke/mountebank-python
  • 28. Response time SLA 28 @sla(300) def order_items_by_id(json): return post('order-items/by-id', json) @sla(500) def order_statistics_by_ip(json): return post('order-statistics/by-ip', json) # utils/measure_time.py def sla(milliseconds): def func_decorator(func): def func_wrapper(*args): r = measure_time(lambda: func(*args)) assert_that(r.time, less_than(milliseconds) return r.result return func_wrapper return func_decorator
  • 29. DB queries vs API requests 29 def test_ok_create_cancel_order_reason(self, request): response = api.create_cancel_order_reason(request) data = db.get_cancel_order_reason_by_id(response.id) assert_that(response, equal_to(data)) def test_ok_create_cancel_order_reason(self, request): response = api.create_cancel_order_reason(request) data = api.get_cancel_order_reason_by_id(response.id) assert_that(response, equal_to(data))
  • 31. Only functional tests 31 # Create # Read # Update # Delete
  • 32. Direct navigation 32 def test_ok_create_cancel_order_reason(self, reason_data): app.create_cancel_order_reason(reason_data) reason = app.get_cancel_order_reason_by_name(reason_data.name) assert_that(reason, equal_to(reason_data)) def create_create_cancel_order_reason(reason_data): open_cancel_order_reason_page() ...
  • 33. Direct asserts in api 33 def test_ok_create_cancel_order_reason(self, reason_data): app.create_cancel_order_reason(reason_data) reason = app.get_cancel_order_reason_by_name(reason_data.name) assert_that(reason, equal_to(reason_data)) def test_ok_create_cancel_order_reason(self, reason_data): app.create_cancel_order_reason(reason_data) reason = api.get_cancel_order_reason_by_name(reason_data.name) assert_that(reason, equal_to(reason_data))
  • 36. Do not use x-path locators 36 driver.find_element_by_xpath('//*[contains(@class, "header__links-bar")]') driver.find_element_by_xpath('//div[contains(@class, "header__links-bar")]') driver.find_element_by_id('links-bar-id')