chifi

blogs about software and science

Follow publication

How To Test Your Software In Julia

An overview of the Test library, and setting up your package to use it.

Emma Boudreau
chifi
Published in
17 min readFeb 11, 2024

After getting a package to a basic production state, one problem that the programmer is going to run into is keeping that software working in production. Though the code is production ready, it is likely there will still be changes made to it. One of the great challenges to this is the many unintended consequences that might come more broadly from changing some functionality. It is also always great to simply know everything is working correctly — especially when you might want to try functions with a various arguments, rather than just sticking to the simple REPL test that is typically done during development. One prominent way to mitigate this problem is to utilize tests.

Tests play in important role in keeping software stable; new changes to the code cannot break the existing code, as then the existing tests would fail and that code would need to be changed before it would ever reach main . Modern repository distributors, such as Github, even offer the option to automatically test to protect a main branch. Needless to say, this is the way software has gone for a long time and providing tests for your software is going to help protect that software in the long-run, especially when that project expands to multiple developers or development teams.

Testing in Julia is done through the Test module. While the Test module itself is really simple and easy to use, setting up a test project and orchestrating your own tests is not quite as straightforward. Considering this, it is vital that we understand the Test package and how to set up these tests to ensure our software always works for everyone.

Testing

Before we get started with building some tests, we are of course going to need a package to test. I have built what is essentially a conceptual skeleton of a web-development ecosystem in Julia, and recently I have taken to going through that template and packaging it into a useful product so I can finally put it into production. With this, I have written a few new packages to support this ecosystem. These packages have been a lot less complicated than an entire web-development ecosystem that I wasn’t sure I could get working in the first place

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

chifi
chifi
Emma Boudreau
Emma Boudreau

Written by Emma Boudreau

i am a computer nerd. I love art, programming, and hiking. https://github.com/emmaccode

Responses (1)

Write a response

Thank you for explaining this so clearly. I haven't seen anything else published on Julia testing. You're a very helpful resource for basic knowledge as well as extremely creative.

10