Top NPM Packages for Spectron Testing

Spectron is a great tool for testing your Electron applications. However, some help is needed to get the full use out of it. This post will go through all of the npm packages I’ve found useful in my Spectron testing.

Jasmine Reporters

The default reporter for Spectron is to just log out to the terminal. That’s great, but I like pretty colors in my terminal, especially when they’re green for success and red for error. That’s where the jasmine reporters package comes in. Actually, there are a few reporters in this package. Not just one for the terminal. In fact, I use two reporters from this package – the terminal reporter and the JUnit XML Result reporter.

Why do I use the second reporter? Well, that reporter plays very well with the jasmine-xml2html-converter package. This package converts the XML results from the JUnit XML Result reporter into an HTML file with graphs and a much easier way to view the tests.

Gulp

Yep, the package to have build tasks in your JavaScript projects has been useful for running Spectron tests. Whether you’re using Jasmine, Mocha, or Karma for your tests, there are gulp versions.

Something I’ve used that seemed to help is to break up your gulp tasks to run tests by scenario. For example, you can have a gulp task that just does log in tests, and another that just does customer profile tests. Gulp allows you to do dependencies as well, so you can have an e2e-all task that runs everything and it can have all of the other tasks as dependencies to that task.

Spectron CLI Tool

Sure, a little plug on my newly released package, but I really feel like this can become a very useful tool for Spectron testing. Currently, it just creates files with a template, which I hope saves a lot of time to those who use it. I hope it can be as useful as the angular-cli is to Angular2 development.


This is just a few packages that have helped me out in my Spectron testing. As I gain more experience with it, this list will grow. As it does, I’ll make sure to keep this post updated.

Do you have any packages that you always use to help during your testing?

Jonathan Wood

Recent Posts

8-Step AWS to Microsoft Azure Migration Strategy

Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…

5 days ago

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

2 weeks ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

4 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago