Movatterモバイル変換


[0]ホーム

URL:


Jachym Cepicky, profile picture
Uploaded byJachym Cepicky
1,094 views

Testing web application with Python

Testing web mapping applications and services using Python provides concise summaries in 3 sentences or less:The document discusses using Python for testing web mapping applications and services, including unit, integration, and system testing. It provides an example of using Selenium to test a web map application, writing tests to interact with elements and assert expected behavior. Implementing tests in Python makes the process easy and allows new programmers to get involved, helping to catch bugs and improve software quality.

Embed presentation

Downloaded 12 times
Testing Web MappingApplications and WebServices using Python
Jáchym ČepickýOSGeo.org● Member● Board member (2012-2015)● SecretaryOpen source software developer, contributor, user● GRASS GIS● PyWPS● OpenLayers, …● http://opengeolabs.czCurrent: Head of Internal development at Cleerio inc.
Cleerio inc.
What is software testing“Software testing is an investigation conducted to provide stakeholders withinformation about the quality of the product or service under test”-- Wikipedia, https://en.wikipedia.org/wiki/Software_testing
What do testers doSoftware testers do not make software.But they make it better-- Sergejus Bartos, http://pt.slideshare.net/SergejusBartos/
What do testers do
What they really do
What they really do
What they really doTesterDeveloper
Software testing impacthttps://en.wikipedia.org/wiki/Software_testingCost to fix a defectTime detectedRequirements Architecture Construction System test Post-releaseTimeintroducedRequirements 1× 3× 5–10× 10× 10–100×Architecture -- 1× 10× 15× 25–100×Construction -- -- 1× 10× 10–25×
TestersDevelopers
History of testingUntil 1956 – Debugging oriented1957–1978 – Demonstration oriented1979–1982 – Destruction oriented1983–1987 – Evaluation oriented1988–2000 – Prevention oriented
Testing typesStatic × Dynamic
Testing typesWhite box × Gray box × Black box
Testing levelsUnit testingIntegration testingSystem testing...
Unit testing
Integration testing
System testing
Unit testing vs. System testing
How we test web mapapplication at Cleerio.com
Unit tests - front-end and back-end
Integration and system tests - manual work
Deploying new version without system testing
…
Learn Python for testing!● Easy to learn● Test frameworks● Geo-positive
Testing software stack
Testing software stack● Jenkins https://jenkins.io/● Python http://python.org● PhandomJS http://phantomjs.org/● Selenium http://www.seleniumhq.org/ | http://selenium-python.readthedocs.io/
Start to lear Python, it’s easy!
Example
from selenium import webdriverfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC# …self.driver = webdriver.Chrome('chromedriver/bin/chromedriver')self.wait = WebDriverWait(self.driver, 90)self.driver.set_window_size(1366, 768)self.driver.get(“http://maps.foo.bar/test”)self.wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '.ol-viewport')))
self.assertTrue(driver.find_element_by_class_name('gs-app'))self.assertTrue(driver.find_element_by_css_selector('div.gs-disclaimer'))
self.wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, div.gs-disclaimer')))div = self.driver.find_element_by_css_selector('div.gs-disclaimer')agree_button = div.find_element_by_css_selector('button[data-gs-handler=agree]')agree_button.click()
with self.assertRaises(NoSuchElementException, msg='Discalimer dismissed'):self.driver.find_element_by_css_selector('div.gs-disclaimer')
menu_button = self.driver.find_element_by_css_selector('div.test-menu-button button[data-gs-handler=menu]')menu_button.click()login_item = case.driver.find_element_by_css_selector('ul.gs-main-menu li button ...')login_button = login_item.find_element_by_xpath('..')login_button.click()
loginform = case.driver.find_element_by_class_name('loginform')self.assertTrue(loginform,"Module login main div visible")
user_input = loginform.find_element_by_css_selector('input[name=login_username]')passwd_input = loginform.find_element_by_css_selector('input[name=login_password]')submit_button = loginform.find_element_by_css_selector('button[data-gs-handler=submit]')user_input.send_keys(login_username)passwd_input.send_keys(login_password)submit_button.click()
self.assertTrue(self.driver.find_elements_by_class_name('test-loader'),"Loading indicator visible")self.wait.until(EC.invisibility_of_element_located((By.CLASS_NAME, 'test-loader')))
with case.assertRaises(NoSuchElementException, msg="Login module div not available"):self.driver.find_element_by_css_selector('div.test-logindiv')
mapcanvas = self.driver.find_element_by_css_selector('canvas.ol-unselectable')action = webdriver.common.action_chains.ActionChains(case.driver)action.move_to_element_with_offset(mapcanvas, 700, 400)action.click()action.move_to_element_with_offset(mapcanvas, 700, 450)action.click()self.driver.save_screenshot('screenie.png')
mapcanvas = self.driver.find_element_by_css_selector('canvas.ol-unselectable')action = webdriver.common.action_chains.ActionChains(case.driver)action.move_to_element_with_offset(mapcanvas, 700, 400)action.click()action.move_to_element_with_offset(mapcanvas, 700, 450)action.click()self.driver.save_screenshot('screenie.png')
Result: Happy product ownerJonáš: Product owner at Cleerio
IssuesTest stability - usually back-end problemDevelopers complaining about tests falling downNot so easy reporting of broken tests
======================================================================ERROR: test_datagrid (tests.map_application.servers.TestBranchComplex)Test gs.module.Datagrid----------------------------------------------------------------------Traceback (most recent call last):File "tests/map_application/__init__.py", line 153, in test_datagriddatagrid.test(self, True)File "tests/map_application/modules/datagrid.py", line 20, in testls_show_module(case, 'datagrid', layer_id)File "tests/map_application/modules/layerswitcher.py", line 169, in show_modulemodule_button.click()File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 75, in clickself._execute(Command.CLICK_ELEMENT)File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 469, in _executereturn self._parent.execute(command, params)File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 201, in executeself.error_handler.check_response(response)File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_responseraise exception_class(message, screen, stacktrace)StaleElementReferenceException: Message: {"errorMessage":"Element is no longer attached to the DOM","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"81","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:46272","User-Agent":"Python-urllib/2.7"},"httpVersion":"1.1","method":"POST","post":"{"sessionId": "89569f10-33c8-11e6-bee5-bb4fe1c88b42", "id": ":wdc:1466084714415"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/89569f10-33c8-11e6-bee5-bb4fe1c88b42/element/:wdc:1466084714415/click"}}Screenshot: available via screen
!** No element<cookie class=”my-cookie” data-value=”chockolate” />found
Conclusion● Easy to setup● Easy to implement with new programmers in team - Python is easy andmakes fun!● Everybody is happy with the result - shipping well tested and integratedapplication with less bugs makes sense● Python is great even for web mapping software tests.
Result 2: Happy testerMagdalena: Tester at Cleerio
?Jachym Cepicky@jachymcjachym.cepicky@cleerio.comMagdalena Kabatova@madlenkkmagdalena.kabatova@cleerio.com

Recommended

PDF
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
PDF
The Future of CSS with Web Components
PDF
Building a js widget
PDF
jQuery in the [Aol.] Enterprise
PPTX
Testing frontends with nightwatch & saucelabs
PDF
20160905 - BrisJS - nightwatch testing
PDF
Jozef Ve Providing Scalability for Pirates, Lizards and Zombies at #DOXLON
PDF
Our application got popular and now it breaks
PDF
JQuery UI
PPT
Jquery ui
KEY
Lazy load Everything!
PDF
Night Watch with QA
PDF
Service workers
PDF
Service Worker - Reliability bits
PDF
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
PPTX
Hybrid app
PDF
Instant and offline apps with Service Worker
PDF
Ten practical ways to improve front-end performance
PPTX
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
PDF
jQuery (DrupalCamp Toronto)
PDF
分层语义化模板实践 ---- 张克军
PDF
JavaScript Libraries (@Media)
PDF
JavaScript Libraries (Kings of Code)
PDF
Mastering Test Automation: How to Use Selenium Successfully
PDF
How To Use Selenium Successfully (Java Edition)
PDF
Selenium documentation 1.0
PDF
Browser-level testing
PPT
Building perfect websites user testing
PDF
Top100summit 谷歌-scott-improve your automated web application testing
PDF
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...

More Related Content

PDF
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
PDF
The Future of CSS with Web Components
PDF
Building a js widget
PDF
jQuery in the [Aol.] Enterprise
PPTX
Testing frontends with nightwatch & saucelabs
PDF
20160905 - BrisJS - nightwatch testing
PDF
Jozef Ve Providing Scalability for Pirates, Lizards and Zombies at #DOXLON
PDF
Our application got popular and now it breaks
DrupalCon Dublin 2016 - Automated browser testing with Nightwatch.js
The Future of CSS with Web Components
Building a js widget
jQuery in the [Aol.] Enterprise
Testing frontends with nightwatch & saucelabs
20160905 - BrisJS - nightwatch testing
Jozef Ve Providing Scalability for Pirates, Lizards and Zombies at #DOXLON
Our application got popular and now it breaks

What's hot

PDF
JQuery UI
PPT
Jquery ui
KEY
Lazy load Everything!
PDF
Night Watch with QA
PDF
Service workers
PDF
Service Worker - Reliability bits
PDF
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
PPTX
Hybrid app
PDF
Instant and offline apps with Service Worker
PDF
Ten practical ways to improve front-end performance
PPTX
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
PDF
jQuery (DrupalCamp Toronto)
PDF
分层语义化模板实践 ---- 张克军
PDF
JavaScript Libraries (@Media)
PDF
JavaScript Libraries (Kings of Code)
JQuery UI
Jquery ui
Lazy load Everything!
Night Watch with QA
Service workers
Service Worker - Reliability bits
HTML5 APIs - native multimedia support and beyond - University of Leeds 05.05...
Hybrid app
Instant and offline apps with Service Worker
Ten practical ways to improve front-end performance
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
jQuery (DrupalCamp Toronto)
分层语义化模板实践 ---- 张克军
JavaScript Libraries (@Media)
JavaScript Libraries (Kings of Code)

Similar to Testing web application with Python

PDF
Mastering Test Automation: How to Use Selenium Successfully
PDF
How To Use Selenium Successfully (Java Edition)
PDF
Selenium documentation 1.0
PDF
Browser-level testing
PPT
Building perfect websites user testing
PDF
Top100summit 谷歌-scott-improve your automated web application testing
PDF
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
PDF
Better Selenium Tests with Geb - Selenium Conf 2014
PDF
How to use selenium successfully
PDF
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
PDF
How To Use Selenium Successfully
PDF
Selenium course training institute ameerpet hyderabad
PDF
Selenium course training institute ameerpet hyderabad – Best software trainin...
PDF
Gilt Groupe's Selenium 2 Conversion Challenges
PPTX
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
PPT
Selenium
PPT
My experience in Software QA
KEY
Graceful Failure with Selenium and Continuous Integration
PPTX
Writing Well Abstracted Automation on Foundations of Jello
PDF
Make Everyone a Tester: Natural Language Acceptance Testing
Mastering Test Automation: How to Use Selenium Successfully
How To Use Selenium Successfully (Java Edition)
Selenium documentation 1.0
Browser-level testing
Building perfect websites user testing
Top100summit 谷歌-scott-improve your automated web application testing
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Better Selenium Tests with Geb - Selenium Conf 2014
How to use selenium successfully
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
How To Use Selenium Successfully
Selenium course training institute ameerpet hyderabad
Selenium course training institute ameerpet hyderabad – Best software trainin...
Gilt Groupe's Selenium 2 Conversion Challenges
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Selenium
My experience in Software QA
Graceful Failure with Selenium and Continuous Integration
Writing Well Abstracted Automation on Foundations of Jello
Make Everyone a Tester: Natural Language Acceptance Testing

More from Jachym Cepicky

PDF
Otevřené standardy, Otevřená data, Otevřený software, Otevření lidé
PDF
PyWPS-4.0.0
PDF
PyWPS Status report
PDF
Switch from shapefile
PDF
PyWPS at COST WPS Workshop
PDF
Webgis, Cloud computing, OGC OWS
PDF
Python testing-frameworks overview
PDF
Úvod do otevřená geoinfrastruktury
PDF
Geosense Geoportal
PDF
Push it through the wire
PPTX
What is the price of open source
PDF
Cepicky os-mapping-frameworks
PDF
How Prague is opening data
PDF
Co může udělat vaše firma pro open source
PPTX
Danube hack 2015 - Open (-data, -communities)
PDF
Sdílené intelektuální spoluvlastnictví
PDF
Open Source JavaScript Mapping Framework
PDF
Cepicky osgeocz
PDF
Cepicky pywps4
PDF
Co brání většímu rozšíření open source nástrojů
Otevřené standardy, Otevřená data, Otevřený software, Otevření lidé
PyWPS-4.0.0
PyWPS Status report
Switch from shapefile
PyWPS at COST WPS Workshop
Webgis, Cloud computing, OGC OWS
Python testing-frameworks overview
Úvod do otevřená geoinfrastruktury
Geosense Geoportal
Push it through the wire
What is the price of open source
Cepicky os-mapping-frameworks
How Prague is opening data
Co může udělat vaše firma pro open source
Danube hack 2015 - Open (-data, -communities)
Sdílené intelektuální spoluvlastnictví
Open Source JavaScript Mapping Framework
Cepicky osgeocz
Cepicky pywps4
Co brání většímu rozšíření open source nástrojů

Recently uploaded

PPTX
"Feelings versus facts: why metrics are more important than intuition", Igor ...
 
PPTX
The power of Slack and MuleSoft | Bangalore MuleSoft Meetup #60
PDF
[BDD 2025 - Full-Stack Development] The Modern Stack: Building Web & AI Appli...
PDF
Cheryl Hung, Vibe Coding Auth Without Melting Down! isaqb Software Architectu...
PPTX
UFCD 0797 - SISTEMAS OPERATIVOS_Unidade Completa.pptx
PDF
How Much Does It Cost to Build an eCommerce Website in 2025.pdf
PDF
[DevFest Strasbourg 2025] - NodeJs Can do that !!
PDF
Agentic Intro and Hands-on: Build your first Coded Agent
PDF
[BDD 2025 - Full-Stack Development] PHP in AI Age: The Laravel Way. (Rizqy Hi...
PDF
Accessibility & Inclusion: What Comes Next. Presentation of the Digital Acces...
PDF
Dev Dives: Build smarter agents with UiPath Agent Builder
PDF
So You Want to Work at Google | DevFest Seattle 2025
PDF
Open Source Post-Quantum Cryptography - Matt Caswell
PDF
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
PDF
DUBAI IT MODERNIZATION WITH AZURE MANAGED SERVICES.pdf
PDF
Mastering UiPath Maestro – Session 2 – Building a Live Use Case - Session 2
PDF
Integrating AI with Meaningful Human Collaboration
PDF
The Evolving Role of the CEO in the Age of AI
PPTX
Connecting the unconnectable: Exploring LoRaWAN for IoT
PDF
How Much Does It Cost To Build Software
"Feelings versus facts: why metrics are more important than intuition", Igor ...
 
The power of Slack and MuleSoft | Bangalore MuleSoft Meetup #60
[BDD 2025 - Full-Stack Development] The Modern Stack: Building Web & AI Appli...
Cheryl Hung, Vibe Coding Auth Without Melting Down! isaqb Software Architectu...
UFCD 0797 - SISTEMAS OPERATIVOS_Unidade Completa.pptx
How Much Does It Cost to Build an eCommerce Website in 2025.pdf
[DevFest Strasbourg 2025] - NodeJs Can do that !!
Agentic Intro and Hands-on: Build your first Coded Agent
[BDD 2025 - Full-Stack Development] PHP in AI Age: The Laravel Way. (Rizqy Hi...
Accessibility & Inclusion: What Comes Next. Presentation of the Digital Acces...
Dev Dives: Build smarter agents with UiPath Agent Builder
So You Want to Work at Google | DevFest Seattle 2025
Open Source Post-Quantum Cryptography - Matt Caswell
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
DUBAI IT MODERNIZATION WITH AZURE MANAGED SERVICES.pdf
Mastering UiPath Maestro – Session 2 – Building a Live Use Case - Session 2
Integrating AI with Meaningful Human Collaboration
The Evolving Role of the CEO in the Age of AI
Connecting the unconnectable: Exploring LoRaWAN for IoT
How Much Does It Cost To Build Software

Testing web application with Python


[8]ページ先頭

©2009-2025 Movatter.jp