Les applications Electron fantastiques

Last update: 2022-01-14

Even after Electron’s own test framework « Spectron » is no longer being developed, it is still possible to professionally test your Electron apps with QF-Test – since version 5.4.0 even better than ever before thanks to CDP connection mode!

Molecule Electron – Testing Electron applications

Many developers – 72% according to a survey from stackoverflow (german version) – are specialized in web development. Web technologies are widely spread and supported by basically all operating systems. They provide a huge range of frameworks to the developers. This doesn’t make desktop applications obsolete. Why not use existing resources from the web for local applications? As the headline states there is already a solution for this: Electron.

Testing Electron apps with QF-Test

Video version

Electron is a framework for executing cross-platform desktop applications using the web browser Chromium and the Node.js framework.

Further information

Almost every user knows or uses Electron apps. Popular apps like Skype, Microsoft Visual Studio Code or Discord are built using the Electron framework. Electron origins from GitHubs well known editor Atom which gave it its initial name « Atom Shell ». The idea of GitHub was to combine the browserless « Node.js » framework with the Chromium rendering engine. This provides an easy and fast way to create desktop apps out of existing web apps. Except for the initial download there is no need for an network connection.

Apps can now be developed using web technologies like HTML, CSS and JavaScript. This enables apps to be developed OS independent which makes them easier to maintain. Even on the code base it is quite easy to handle native functions like menus, notifications, access to the file system and also some low-level informations about the hardware.

The best summary for the framework comes from the official site:  « It takes care of the hard parts so you can focus on the core of your application. »

But I don’t write this to sing the praises of Electron – of course I want to mention that QF-Test supports testing of Electron apps since version 4.5 and I want to give a quick introduction.

How to test Electron Applications with QF-Test

The basic concept is still the same. The best way to connect to an Electron app is by using our Quickstart Wizard (Menu: Extras → Quickstart Wizard). Then select « An Electron application » and on the next page you select the app you want to test plus option command line parameters.

Quickstart Wizard for Electron apps

The next step is to specify the ChromeDriver. You can either choose the correct Electron version or let QF-Test detect it so you know what ChromeDriver version you need. QF-Test can then automatically download the ChromeDriver.

Electron provides all features already known from the web. Additionally native menus can be controlled by a Selection step (Insert->Event  nodes->Selection). The syntax looks like this:

mainWindow = new BrowserWindow...

To be able to control this functionality QF-Test has to get access to the Electron API. This means that the following values (currently default) inside the BrowserWindow should not be changed.

mainWindow = new BrowserWindow({
    webPreferences: {
        enableRemoteModule: true,
        contextIsolation: false,
        nodeIntegration: true
    }
})

Please try it yourself and test your own app! If you only have an older version of QF-Test (<4.5) you can get the latest version for free from this site and evaluate it: Free trial

Nous utilisons des cookies "Matomo" pour l'évaluation anonyme de votre visite à note page web. Pour cela nous avons besoin de votre consentement qui est valable pour douze mois.

Configuration de cookies

Cookies fonctionnels

Nous utilisons des cookies fonctionnels pour garantir la fonctionnalité de base du site web.

Cookies de performance et de statistique

Nous utilisons Matomo pour analyser et améliorer notre site web. Des cookies permettent une collection anonyme des informations qui nous aident à vous offrir un visite clair et facile à utiliser de nos pages web.

Détails des cookies
Description Fournisseur Durée de vie Type But
_pk_id Matomo 13 Mois HTTP Contient un identifiant de visiteur unique et pseudonymisé interne à Matomo pour reconnaître les visiteurs qui reviennent.
_pk_ref Matomo 6 Mois HTTP Utilisé pour suivre à partir de quel site Web l'utilisateur anonymisé est arrivé sur notre site Web.
_pk_ses Matomo 1 Jour HTTP Le cookie de session Matomo est utilisé pour suivre les demandes de page du visiteur pendant la session.
_pk_testcookie Matomo Session HTTP Utilisé pour vérifier si le navigateur du visiteur prend en charge les cookies.
_pk_cvar Matomo 30 Minutes HTTP Stocker temporairement les données relatives à la visite.
_pk_hsr Matomo 30 Minutes HTTP Stocker temporairement les données relatives à la visite.