How to handle decimal numbers in form params with WireMock

I wrote about WireMock last year. It's a very powerful tool that lets us replace external services with stubs while testing. Since it can be configured on the fly by tests, it allows us to validate virtually any behavior. Here's how I use it:

How WireMock works: sequence diagram

In this sequence diagram, a test tells WireMock to return a JSON body for every request to /fetch-details. During execution, the test calls /some-endpoint to validate it. This endpoint needs data from an external service to produce a response, so it requests /fetch-details and gets the JSON body that the test fed WireMock at the start. By changing what /fetch-details returns, we can easily simulate various scenarios.

In this post, I want to cover a case I dealt with recently: form data with decimal numbers.

Read more...

Running FMS Data Manager on Linux with WINE and X-Plane 12

Navigraph is probably the most popular source of navigation data for flight simulators. Roughly once a month they release a new data package with updated waypoints and metadata, such as altitude and speed restrictions, as well as changes to procedures at airports around the world. Updating this data can be a bit tedious, so they offer a program to help us with that - which, of course, isn’t available on Linux. There isn't much information on this topic online, so hear me out, world wide web: you can run FMS Data Manager using WINE.

X-Plane 12, Lufthansa Boeing 737-800 in Tallinn, Estonia (EETN)

Read more...

Function overloading in TypeScript

As more and more companies migrate from Java to JavaScript for UI and API testing, I decided to study it too. After all, even this blog is powered by React. One of the features I sometimes used in Java is function overloading, which I thought wasn't possible in JavaScript. However, as I've recently learned, TypeScript adds this functionality. Well, kind of.

JavaScript code on a screen

Photo by Pixabay

Read more...

GNOME Screenshot: How to change default directory and file type

I've recently switched from Plasma to Cinnamon, and so far, I like it. However, while the latter is more stable, it's also less feature-rich - at least on Arch Linux. So, when I'd installed GNOME Sreenshot, I realized that I can't really configure it through the user interface. It's rather basic, with no settings in the menu to change the default directory or file format.

GNOME Screenshot window

Search results on the subject were old, with posts dating back 10-15 years, which always makes me suspicious: how relevant is that information today? That's why I decided to jot down my findings.

Read more...

An unexpected letter

Today I received a scary looking letter from abuse@hetzner.de, which is my German hosting provider. The text started as follows:

We have received a notification from the German Federal Office for Information Security...

Knowing how notorious German laws are when it comes to intellectual property, I immediately thought: "What did I do?" and "How big is the fine?" To my best knowledge, my blog doesn't violate any rules, yet I didn't expect a message from a Federal Office without any wrongdoing.

Selective Focus Photo Of Bottle Floating On Body Of Water

Photo by Maria Tyutina

Read more...

How to override Awaitility error messages

Awaitility is an excellent Java library. It's especially useful for working with eventually consistent APIs. For instance, when a client sends a POST, PUT, or DELETE request, you might need to make several GET requests before observing the changes, which is terrible for automated tests. A common solution to this problem is to use Awatility. You can ask it to execute code for n seconds until the request succeeds or the timer expires.

await()
    .atMost(Duration.ofSeconds(5))
    .until(() -> apiClient().get(id).getStatus().equals("expected"));

Unfortunately, the default error messages could use some work.

Hourglass on Brown Wooden Frame

Photo by Mike

Read more...

Bruno: Yet another alternative to Postman

Postman has long been, and continues to be, an industry standard for API testing. Numerous beginner courses for QA engineers dedicate sections to explaining how to use it. Software developers, product owners, database administrators, and many others often have Postman installed as well. Another prominent tool is Insomnia.

Both, unfortunately, push their users to create accounts and share often commercial information with their cloud services. I don't mind online collaboration, it can be really helpful, especially in large teams. However, I dislike when perfectly capable products start introducing artificial barriers that persuade customers to use features they don't need and never asked for. Do I need a cloud workspace to work on a course project? No. There's a term for that: enshittification.

Bruno: main window

A few months ago, I discovered another API client called Bruno, which offers a healthy alternative.

Read more...

Mild rant about electronics

I found myself in a rather silly situation, where I had to replace my perfectly capable smartphone. Even though its battery wasn't good after eight years - once I'd finished a carsharing trip two minutes before it died - the device was more than sufficient for all my use cases. I could take pictures, chat in instant messengers, browse websites, read emails, use an online bank, and so on. From that perspective, it totally satisfied my needs.

Smartphone in a shopping cart

Photo by Nataliya Vaitkevich

Read more...

Easy to implement light and dark themes with light-dark() css function

With dread in my heart, I connected to the world wide web. I wanted to learn how to code the switch between light and dark themes for this blog, expecting some messy javascript hacks to load either one css file or another. To my pleasant surprise, I found a relatively new function that solves this exact problem: light-dark(). It essentially accepts two arguments: a color for the light theme and a color for the dark theme. Since the browser knows what the user wants, it picks the suitable color. That's it!

Dark and light themes

Read more...

New design

It was inevitable, wasn't it? After working on raweceek.eu with its old-school design and spending time looking at other websites a similar aesthetic, I couldn't not update my own blog. After all, this is my personal space on the internet, and right now, I want it to feel more fun and less sterile. This is the first redesign in my blog’s life, and quite frankly, I’m surprised I’m still using it after 1.5 years. Anyway, if you don’t see major changes, try refreshing the page with ctrl + shift + r.

Colorful pens arranged in a mason jar on a light wooden desk

Photo by Jessica Lewis 🦋 thepaintedsquare

Read more...

RaweCeek.eu update

When I created raweceek.eu last year, I quickly decided to build it with React due to my familiarity with the library. However, over time I realized that using so much client-side code for such a simple website was silly. It was like using a sledgehammer to crack a nut. Even worse, older systems couldn’t display the page because browsers like IE6 and its predecessors don’t support contemporary JavaScript features. So I decided to change that.

Raweceek.eu on Windows XP, Internet Explorer 6

Read more...

Trie data structure

I recently learned about a trie data structure. While it may not be as widespread as arrays, hash tables, linked lists, or binary trees, there are applications where it excels. The main advantage of a trie is that you can search in constant time, regardless of how many elements it contains. This makes tries useful for autocomplete systems, spell checkers, dictionaries, and similar applications.

A tree in black and white

Read more...

rF2 Stint Visulaser is back online

Last year, I created a tool for rFactor 2 to visualize racing stints. Here's what it produces:

rF2 Stint Visualizer: example

Since then, I'd moved away from GitHub and made all my repositories private just to avoid confusion caused by having the same projects hosted in various places with different code. This led to GitHub Pages restricting access to the visualizer, which I had previously hosted there.

Yesterday I brought it back online. You can now find it here: rf2sv.fakeplastictrees.ee. For anyone unfamiliar with the tool, please refer to my original post, where I spoke about its purpose and limitations.

Read more...

Lombok compilation error: cannot find symbol

I was working on the service that powers this blog when I stumbled upon an odd issue.

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /app/service/src/main/java/ee/fakeplastictrees/blog/service/user/model/UserExceptionFactory.java:[8,1] cannot find symbol
  symbol:   static withData
  location: class ee.fakeplastictrees.blog.service.core.exceiption.PublicExceptionFactory

There were 52 more errors like this in different classes. I hadn't changed the Java version or any dependencies since the previous build. Moreover, most of the files that reported failures had absolutely no changes in them. I was able to build this code not long ago! It was as if lombok had suddenly stopped working for no obvious reason. Nothing in maven's log pointed to the root cause.

A confused man screaming at his laptop

Photo: not exactly me, but the same energy.

Search results were misleading and suggested that my project was configured incorrectly, even though it had worked in the exact same environment just a couple of weeks ago. Eventually, I found the answer!

Read more...

Burp Suite: a helpful tool for testing of client-server software

As a test engineer, I often need to see what requests applications are making and what responses they are receiving. While browsers offer developer tools that include network monitoring, I find them inconvenient. Additionally, you can't use them with mobile and desktop software.

Recently, I discovered Burp Suite, a tool for security assessment and penetration testing that comes with many useful features. Although the professional edition is quite expensive, the free community edition is sufficient for regular testing activities.

Burp Suite

Key functionality

  • A proxy server to intercept traffic.
  • A convenient user interface to analyze network activity.
  • The ability to modify and repeat requests.
  • The option to store individual requests for future use; however, the history is erased in the community edition when you close the program.
  • A text decoder that automatically translates strings like "%7B%22key%22:%22value%22%7D" to {"key":"value"}.
Read more...

Rawe Ceek - is it a race week?

Last month, I bought a domain: raweceek.eu. It refers to a confusing image posted by Ferrari on Twitter ahead of a Formula 1 race in 2020. The text on the image can be read as both "race week" and "rawe ceek", and it quickly became a meme in the community.

2020 British Grand Prix: Race week / Rawe ceek

I didn't have anything specific in mind before the purchase. I wanted to create something fun, a lighthearted website that could be of use, but wouldn't require regular maintenance. And so the feature was born from the meme's name: visitors should be able to quickly see whether the current week is a race week or not!

Read more...

Plasma's spare layouts not working on Wayland: workaround

I decided to try Wayland due to some issues I suspect might be related to Xorg. So far, so good. However, it comes with its own problems. Spare layouts don't seem to be working as expected. It's a super useful feature for those who have more than two layouts because it makes cycling through them much easier. According to the documentation:

Spare layouts allow to toggle between small number of layouts easily while keeping more layouts handy close by. For example you might use 3 languages: English, Ukrainian and German but first two are used often and third one just occasionally. In this case you can configure first two as main layouts and German one as spare one - when you toggle with keyboard and left mouse button the switch will happen between main layouts only but you can always choose 3rd layout with context menu.

Here is my configuration:

Plasma system settings: keyboard layouts

I want alt+shift to only switch between English and Russian. Unfortunately, this setup doesn't work as intended: all layouts are in the rotation. Therefore, switching from Russian to English takes an extra step through German. Ideally, I want to use German only when I'm practicing it via the applet on the taskbar.

I found a workaround for this bug!

Read more...

How to mock server responses while testing web apps with Playwright?

Playwright is a relatively new automation library for browser testing. Despite that, it has already gained some user base, with articles and tutorials regularly appearing on Software Testing Weekly. It comes with many features necessary for UI tests, but crucially, it can also work with API requests made by the web app under test. This allows us to either completely mock responses from a backend server, or alter them - depending on what we want to achieve. In this post, I will show how to do both things in Java.

A laptop with a code editor open

Read more...