A What Test? - A blog post the basic idea of unit testing

5 Likes

Ideally, when developing code in conjunction with fpm(1) the developer is creating code in the test/ directory so that the package can be testing periodically by merely entering “fpm test”.

That means you can use a standard template as a github action that you can merely copy into a .github directory and those tests become automated for any fpm-based github site. I have been playing with that concept (the action files are in the .github/ directory in M_time at the moment but still basically in alpha).

It would be interesting to see a small example module set up to be tested with the unit-testing framework described here via “fpm test”, and then copy the .github/ directory into it in a github repository. It would then be tested automatically in Windows, MacOS, and Ubuntu with gfortran, and in Ubuntu with ifort; where the Windows tests would use a straight Windows environment as well as Mingw64 and Msys2.

Most of my own github repos already use other forms of testing but wondering if you have anything that would fit the bill as a demonstration of how the confluence of git/github/github actions and fpm and your unit testing framework used as an fpm(1) dependency can create a powerful CI development environment basically out of the box?

I have recently begun using such a scheme, and I really like how the same tools can be used seamlessly from the CLI (ie. enter “fpm test”, and use fpm(1) to obtain a unit testing framework via a simple dependency) – so you can transition into or out of something like a collaborative WWW-based automated testing environment to a basic stand-alone CLI environment without becoming wholly dependent on any of the products. I find the concept very appealing.

And future=planned fpm interfaces into other packaging formats makes it even more attractive as it would be a very flexible development method.

My .github/ directory is only written from a newbie perspective but it would be able to support such a demonstration, and I think seeing something very basic where all the emerging parts come together will entice others to look at it that way too.

2 Likes

I have some client projects that are doing exactly that. Most of my open source projects are hosted on GitLab, so the CI for them is only testing on Linux, but since I’ve got clients using them with CI in Windows, I have a fair amount of confidence. I would definitely like to put together an example of using GitHub Actions with fpm and vegetables. I’m in the process of writing a tutorial for vegetables, so maybe I will put the example on GitHub and have a section talking about the CI.

I think in the future it would be nice for fpm to have/support multiple new project templates, maybe even custom ones. I would definitely be up for writing one that used vegetables and GitHub Actions that could come “out of the box”.

1 Like