Testing for Extension: Automated CI/CD and Self Test

We’re developing a extension for 3D Slicer. I’m thinking about how we can do automated testing with CI/CD tool. If we can do with GitHub Action maybe. We can install 3D Slicer in the pipeline, but I don’t know how we can use GitHub action to run the script to open our extension and click some button to test it.
About Self tests (test will run when we click Reload & Test in the UI), can we check if all UI elements load, then click some elements then test the state of app (Similar to automated Web testing)?
Thank you in advance.

For extensions that get built with Slicer as part of the nightly process the CI is done automatically and posted to the dashboard. This includes building any C++ code, running SelfTests and other tests, and packaging for all platforms. If you want to replicate that process yourself for a non-public extension all the code and scripts are available.

If your extension is private but python only, you could take a simpler route and develop some CI that just runs your extension code against a downloaded Slicer binary using a virtual desktop like Xvfb or Xdummy.

SlicerDMRI created a GitHub Actions workflow to build and test its extension at time of PR instead of waiting for the nightly Slicer factory build and test of extensions.

See the workflow below. SlicerDMRI/.github/workflows/build-test.yml at b4357b934f82c9ced74e0ba0defed7f0a89b792d · SlicerDMRI/SlicerDMRI · GitHub

It has a Build Slicer step which takes 2 hours and 20 minutes. You can see the various steps of the workflow in this run:

1 Like