We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Front-end testing with Python

Formal Metadata

Title
Front-end testing with Python
Title of Series
Number of Parts
160
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Front-end testing with Python [EuroPython 2017 - Talk - 2017-07-10 - PyCharm Room] [Rimini, Italy] Web-developers use Python to develop web-applications, serving HTML or JSON content to user's browsers which render it. We test our applications to check that they serve content right and that they respond to HTTP requests in an expected way. However, this is not all that happens in a modern web application. There are lots of moving parts which are executed not on the server, but directly in user's browser, and they need to be tested too. The best way to check that our app works well in a browser is to test it in a browser, and Python gives you tools to do that conveniently. With a Selenium tool and Python package, you can control the browsers, making them open web pages and interacting with them. I will show how to install Selenium and needed drivers, and tell about best practices for writing Selenium tests, such as Page Object pattern Put browser interactions in the page object, not the test Put assertions in the test, not the page object Never use time.sleep() Always make pages wait for actions to complete Wait for JavaScript to load To test the visual look of your application there is a Needle tool, which lets you compare screenshots with baseline set, and highlight the differences. I will talk about how to incorporate that functionality into your tests. As browser testing can get quite slow, I will also show how to set up running them concurrently