Milestone achieved: Code coverage for Shopware 6 - 80%

09/21/2020 Plugin updates New

Code coverage, one of the more important metrics when evaluating your code quality. In this article we’ll give you some insight into what code coverage is exactly, along with something that we’re very proud of, our recent milestone: being the first to achieve 80% code coverage in Shopware 6, and what that means for us and the end-user.

Refresher; what is code coverage?

Code coverage is one of those terms you hear often, yet few people have a clear explanation on hand.

To define the metric, you can see it as the following: Code coverage is a measurement of how many lines, blocks and arcs of your code are executed, while the automated tests are running. In other words, how much of your code is actually covered by the automated tests.

When changes are made to the code in one place, it might have unforeseen effects on other sections of the code, a good code coverage percentage will allow you to recognise this almost instantly.

Automatic testing

The MultiSafepay integration specialists have always gone through an extensive testing phase before releasing new plugins publicly. Although thorough and effective, it takes up a large amount of time for our specialists. In order to save time and work more efficiently, we dedicated ourselves to automatic testing from the get-go when we released our Shopware 6 plugin.

Due to our efforts when our Shopware 6 plugin was in its infancy, we are now at a steady 80% code coverage. Manual testing is still carried out before every major release, as a precaution. The main benefit automatic testing brings us is not having to do manual tests whenever we make changes to our code.

To quote our lead developer, Jasper Nadi:

“We will never strive for a 100% code coverage. Our goal is to keep our functionalities running properly, which means you don’t need a 100% coverage. As Goodhart once said: ‘When a measure becomes a target, it ceases to be a good measure.’ We now have a situation that allows us to ensure proper functioning and keep the required maintenance manageable, which makes me very proud.”

Main advantages

Maintaining a steady code coverage percentage has many benefits, one of the main benefits comes with changes to the existing code. Normally when adjusting code for one part of your plugin, it could cause issues in a different section. Checking this manually takes time and has the potential for human errors, automatic testing gives you a near-instant answer whether or not everything is functioning properly and human error is not a factor.

Effectively, this also allows us to implement any new Shopware 6 releases immediately. Ensuring the proper functioning of our plugins now, and in the future. From this faster implementation and overall control of code, stems a better user experience. The majority of the code will be constantly checked and if needed corrected, ensuring that as little bugs and errors as possible remain.

To summarize, a higher percentage of code coverage will provide us with the following benefits:

  • Increased quality of overall product
  • Improved customer experience/satisfaction
  • Faster time to market for new features
  • Easier to maintain code base in the future

Through our automatic testing in our Shopware 6 plugin, we separate ourselves from the competition. We’re very proud of what we’ve achieved, and will aim to achieve similar results for our other plugins.


Would you like to sell more through our solutions?

Contact us