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

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

More Related Content

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

What's hot

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

Similar to Testing web application with Python

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

More from Jachym Cepicky

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

Recently uploaded

PDF
[BDD 2025 - Mobile Development] Crafting Immersive UI with E2E and AGSL Shade...
PPTX
UFCD 0797 - SISTEMAS OPERATIVOS_Unidade Completa.pptx
PDF
[BDD 2025 - Full-Stack Development] PHP in AI Age: The Laravel Way. (Rizqy Hi...
PDF
The Necessity of Digital Forensics, the Digital Forensics Process & Laborator...
PDF
10 Best Automation QA Testing Software Tools in 2025.pdf
PDF
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
PDF
Mastering UiPath Maestro – Session 2 – Building a Live Use Case - Session 2
PDF
[DevFest Strasbourg 2025] - NodeJs Can do that !!
PDF
So You Want to Work at Google | DevFest Seattle 2025
PPTX
"Feelings versus facts: why metrics are more important than intuition", Igor ...
 
PDF
How Much Does It Cost To Build Software
PDF
MuleSoft Meetup: Dreamforce'25 Tour- Vibing With AI & Agents.pdf
PPTX
kernel PPT (Explanation of Windows Kernal).pptx
PDF
"DISC as GPS for team leaders: how to lead a team from storming to performing...
 
PPTX
Leon Brands - Intro to GPU Occlusion (Graphics Programming Conference 2024)
PDF
[BDD 2025 - Artificial Intelligence] AI for the Underdogs: Innovation for Sma...
PDF
KMWorld - KM & AI Bring Collectivity, Nostalgia, & Selectivity
PDF
The partnership effect: Libraries and publishers on collaborating and thrivin...
PDF
Mastering Agentic Orchestration with UiPath Maestro | Hands on Workshop
PPTX
Guardrails in Action - Ensuring Safe AI with Azure AI Content Safety.pptx
[BDD 2025 - Mobile Development] Crafting Immersive UI with E2E and AGSL Shade...
UFCD 0797 - SISTEMAS OPERATIVOS_Unidade Completa.pptx
[BDD 2025 - Full-Stack Development] PHP in AI Age: The Laravel Way. (Rizqy Hi...
The Necessity of Digital Forensics, the Digital Forensics Process & Laborator...
10 Best Automation QA Testing Software Tools in 2025.pdf
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
Mastering UiPath Maestro – Session 2 – Building a Live Use Case - Session 2
[DevFest Strasbourg 2025] - NodeJs Can do that !!
So You Want to Work at Google | DevFest Seattle 2025
"Feelings versus facts: why metrics are more important than intuition", Igor ...
 
How Much Does It Cost To Build Software
MuleSoft Meetup: Dreamforce'25 Tour- Vibing With AI & Agents.pdf
kernel PPT (Explanation of Windows Kernal).pptx
"DISC as GPS for team leaders: how to lead a team from storming to performing...
 
Leon Brands - Intro to GPU Occlusion (Graphics Programming Conference 2024)
[BDD 2025 - Artificial Intelligence] AI for the Underdogs: Innovation for Sma...
KMWorld - KM & AI Bring Collectivity, Nostalgia, & Selectivity
The partnership effect: Libraries and publishers on collaborating and thrivin...
Mastering Agentic Orchestration with UiPath Maestro | Hands on Workshop
Guardrails in Action - Ensuring Safe AI with Azure AI Content Safety.pptx

Testing web application with Python


[8]ページ先頭

©2009-2025 Movatter.jp