/plushcap/analysis/sleuth/automated-browser-testing

Automated browser testing, explained in code

What's this blog post about?

The text discusses automated browser testing and its implementation using code. It explains how tests are run in a headless Chrome instance during CI, while pop-ups are allowed for interaction and debugging during development and testing. Commands are issued to the browser to simulate user actions like clicking, typing, moving, hovering, or dragging and dropping. The data returned from these commands is used to drive more commands or perform assertions. SQL queries are run on the database to verify if the intended interactions were performed successfully. Assertions based on data retrieved from the web or database follow. The text then delves into a real-world example of browser tests using Python and Django frameworks, with Selenium for web browsers. It demonstrates how page objects are used to encapsulate all browser interactions at a high level, making tests more readable and maintainable in the long run. The concept of test driven development is also discussed, where tests can be written before implementing the page, and then continuously run until the test passes. Debugging flaky tests is another important aspect covered. A code snippet is provided that captures a screenshot of the browser at the point of failure, allowing developers to reproduce and solve issues quickly. The text concludes by encouraging viewers to engage with the presenter on Twitch for further discussions or questions related to testing, CICD, or continuous deployment.

Company
Sleuth

Date published
Feb. 16, 2021

Author(s)
Don Brown

Word count
1647

Hacker News points
None found.

Language
English


By Matt Makai. 2021-2024.