Posts

Showing posts from April, 2022

Let the computer test your Python GUI application

Image
Let the computer test your Python GUI application In this article you’ll see how easy it is to write automated tests for Graphical User Interfaces (GUIs) written using the brilliant guizero Python library. I’ll start with a horror story which explains why I’m so keen on automated GUI tests. Next I’ll describe an application that I’m using as an example. The code for the app and the test are available on GitHub; the link is in the resources section at the end of this post. After that, I’ll show how the tests are built up and describe how they enabled me to find and fix a bug. A personal horror story A couple of years ago I presented a Quiz Runner application to an audience of Digital Makers. The Quiz Runner application used a workstation to manage the Quiz. Quiz Contestants used micro:bits to ‘buzz’ in when they thought they knew an answer. The micro:bits communicated via radio using the micro:bit’s built-in radio capability, and everything (workstation and micro:bits) was pro...

Choosing a Python library

You’re working on a Python project, and you realise the next thing to do is a bit tricky. You don’t want to reinvent the wheel if you don’t have to. You wonder: has someone solved this problem before? The first place to look is the Python Standard Library . One of Python’s great strengths is that it comes with batteries included; there are well-documented, tried and tested libraries to do all sorts of useful things. No luck ? Turn to GitHub for help - it usually can! Most of the libraries I use are hosted on GitHub. Sometimes you’ll just find one candidate library; sometimes there will be more than one. You’ll need to decide if any fit the bill, and which looks best. As we’ll see, GitHub can tell you a lot about the quality of the project. Here are the things I like to ask about a library I’m considering. I’ve illustrated the checklist using the guizero project as an example, since I use it a lot and it ticks all the boxes. Does it have good documentation? Is the inten...