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
Selenium documentation 1.0
PDF
How To Use Selenium Successfully (Java Edition)
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
Selenium documentation 1.0
PDF
How To Use Selenium Successfully (Java Edition)
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
KEY
Graceful Failure with Selenium and Continuous Integration
PPT
My experience in Software QA
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
Selenium documentation 1.0
How To Use Selenium Successfully (Java Edition)
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
Graceful Failure with Selenium and Continuous Integration
My experience in Software QA
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
Switch from shapefile
PDF
PyWPS Status report
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
PPTX
Danube hack 2015 - Open (-data, -communities)
PDF
Co může udělat vaše firma pro open source
PDF
Sdílené intelektuální spoluvlastnictví
PDF
Open Source JavaScript Mapping Framework
PDF
Cepicky pywps4
PDF
Cepicky osgeocz
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
Switch from shapefile
PyWPS Status report
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
Danube hack 2015 - Open (-data, -communities)
Co může udělat vaše firma pro open source
Sdílené intelektuální spoluvlastnictví
Open Source JavaScript Mapping Framework
Cepicky pywps4
Cepicky osgeocz
Co brání většímu rozšíření open source nástrojů

Recently uploaded

PDF
Mulesoft Meetup Online Portuguese: MCP e IA
PDF
[BDD 2025 - Mobile Development] Exploring Apple’s On-Device FoundationModels
PDF
[BDD 2025 - Full-Stack Development] The Modern Stack: Building Web & AI Appli...
PDF
10 Best Automation QA Testing Software Tools in 2025.pdf
PDF
How Much Does It Cost to Build an eCommerce Website in 2025.pdf
PDF
[BDD 2025 - Mobile Development] Crafting Immersive UI with E2E and AGSL Shade...
PDF
Dev Dives: Build smarter agents with UiPath Agent Builder
PDF
Agentic Intro and Hands-on: Build your first Coded Agent
PDF
Accessibility & Inclusion: What Comes Next. Presentation of the Digital Acces...
PDF
MuleSoft Meetup: Dreamforce'25 Tour- Vibing With AI & Agents.pdf
PDF
Lets Build a Serverless Function with Kiro
PDF
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
PDF
Mastering Agentic Orchestration with UiPath Maestro | Hands on Workshop
PPTX
Support, Monitoring, Continuous Improvement & Scaling Agentic Automation [3/3]
PDF
Top Crypto Supers 15th Report November 2025
PPTX
kernel PPT (Explanation of Windows Kernal).pptx
PDF
Transcript: The partnership effect: Libraries and publishers on collaborating...
PDF
5 Common Supply Chain Attacks and How They Work | CyberPro Magazine
PDF
The partnership effect: Libraries and publishers on collaborating and thrivin...
PDF
How Much Does It Cost To Build Software
Mulesoft Meetup Online Portuguese: MCP e IA
[BDD 2025 - Mobile Development] Exploring Apple’s On-Device FoundationModels
[BDD 2025 - Full-Stack Development] The Modern Stack: Building Web & AI Appli...
10 Best Automation QA Testing Software Tools in 2025.pdf
How Much Does It Cost to Build an eCommerce Website in 2025.pdf
[BDD 2025 - Mobile Development] Crafting Immersive UI with E2E and AGSL Shade...
Dev Dives: Build smarter agents with UiPath Agent Builder
Agentic Intro and Hands-on: Build your first Coded Agent
Accessibility & Inclusion: What Comes Next. Presentation of the Digital Acces...
MuleSoft Meetup: Dreamforce'25 Tour- Vibing With AI & Agents.pdf
Lets Build a Serverless Function with Kiro
Parallel Computing BCS702 Module notes of the vtu college 7th sem 4.pdf
Mastering Agentic Orchestration with UiPath Maestro | Hands on Workshop
Support, Monitoring, Continuous Improvement & Scaling Agentic Automation [3/3]
Top Crypto Supers 15th Report November 2025
kernel PPT (Explanation of Windows Kernal).pptx
Transcript: The partnership effect: Libraries and publishers on collaborating...
5 Common Supply Chain Attacks and How They Work | CyberPro Magazine
The partnership effect: Libraries and publishers on collaborating and thrivin...
How Much Does It Cost To Build Software

Testing web application with Python


[8]ページ先頭

©2009-2025 Movatter.jp