April 26, 2022

How Dutchie Engineers create and use TestRail packages in Dart

Dalvin Sejour
April 26, 2022

Note: Tech talk is a section for Dutchie Engineers to share their experiences with other tech enthusiasts. This piece explains how we've stood up a robust testing infrastructure in our Mobile Engineering org to catch issues before they are in production. To increase our resiliency, we developed a TestRail package in Dart to help us be able to seamlessly automate our testing. Continue reading below.

At Dutchie, we support over 5,000 dispensaries across the US and Canada. Our Greenbits Register has Flutter built-in, featuring Dart—one of the fastest-growing programming languages. Creating a well-tested mobile application is imperative for a consumer-facing product like a register, especially with the stigma around cannabis transactions. We want to ensure our dispensary partners stay compliant at all times, so making these experiences as seamless as possible is our Mobile Engineering Organization's top priority.

TestRails for testing coverage

That’s why we have invested a lot of time in our testing infrastructure. TestRail is a great add-on to our existing unit and widget tests, as it allows us to stay on top of our total test coverage. We lean heavily on TestRail, a test reporting CMS software for our mobile applications. Currently, TestRail provides SDKs for Java, PHP, Python, Ruby, and .NET, but lacks an implementation for Dart, the language that Flutter is built on. As developers can get a lot of utility from TestRail the automated reporting inside of their codebase. It helps us to automate testing for our different widgets and allows us to catch shifts in code coverage. That is why we have created a TestRail package in Dart which is now available for use at Pub Dev. This package is a thin wrapper around the TestRail API that will allow for automated test reporting in Dart. It enables a user to start, report case pass/fail, and close your test runs from a Dart interface.

How to use, configure, and report 

Using the package is as simple as passing in your TestRail server address, username, and password. Then you are able to create tests, retrieve tests, and update tests, inside of your codebase automatically. This solution is perfect for any organization looking for an easy way to begin tracking test coverage in their application out of the box. We use the application to auto-report test data to Slack, which is a custom configuration we added in our repo to notify the team when there are regressions in the testing framework. This setup requires further configuration but shows some of the ways the package can improve the developer experience.

This allows us to weed out any issues before it goes to production, which keeps the software running smoothly. You can check out the repo here.

Feeling inspired? Join our team of Dart and Flutter Developers today.

About the author
Dalvin Sejour
Software Engineer II at Dutchie