Search code examples
testingdeploymentelectronsoftware-designsoftware-distribution

How to test/debug cross-platforms desktop apps(Windows, MacOS) with limited resources


I am trying to build a desktop app.
I am thinking of using electron on the recommendation of a web-developer friend of mine,
but as I am the only sole developer, I don't have the means to test the software on different platforms(OS, hardware etc.).
So I am anticipating that this will cause a problem later, in the end, to test/debug software on different platforms and different OS.
I have ruled out web-apps because of some privacy concerns of the users for the remote data hosting.
Software is pretty lightweight and is almost equivalent to the image viewer apps with some slight modifications.
How to solve the problem of variations of different platforms? Any literature suggestions pointing me in the general direction are also welcome.


Solution

  • Sometimes it helps to think of Electron as two processes.

    The renderer vs the main processes. Generally the renderer process which runs the HTML/CSS/JS is it's own isolated component, and you communicate to the main process using IPC.

    So generally for the UI, you can use mostly any web based testing framework to test reliability. At Amna, for example, we use Cypress as our E2E testing platform. You an also use something like QAWolf. Both should work with localhost. In general, most website testing tools should work fine, and consistently across platforms.

    Where this gets tricky is when a UI functionality makes a call to the OS or the main process. For example, saving to the disk, or launching a program.

    The general flow is this, and I've yet to find radically simpler options:

    1. Set-Up a VM or buy a machine with the corresponding OS. I used Spot VMs in Azure for this.

    2. Manually test the scenarios you care about in each VM before you ship

    If you have a lot of cases that rely on the OS, then you should be able to further optimize this by using an automated test runner like Spectron.

    From experience, what I've realized is that most of the iterations I do happen more on the UI than the underlying functions with the cross-platform capabilities. And if your code has good separation (e.g. contextIsolation:true, nodeIntegration:false), it should be pretty obvious when you need to do an entire "cross-platform" test vs just UI tests.

    I'm not familiar with a lot of large-scale electron testing frameworks, I do know that ToDesktop handles package building and generating binaries to perform a smoke test and verify things open across different operating systems.