# Testing without launching graphical components

**URL:** <https://discourse.slicer.org/t/testing-without-launching-graphical-components/32506>\
**Category:** Development\
**Tags:** testing\
**Created:** [October 31, 2023, 2:19pm UTC](https://discourse.slicer.org/t/testing-without-launching-graphical-components/32506 "2023-10-31T14:19:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)\
**Post date:** [October 31, 2023, 2:19pm UTC](https://discourse.slicer.org/t/testing-without-launching-graphical-components/32506/1 "2023-10-31T14:19:16Z")

</div>

Hi,  
I am trying to set up a GHA workflow to test the SlicerDMRI extension. `ctest` is effectively finding and triggering the tests so far:  
[ENH: Test build · SlicerDMRI/SlicerDMRI@576ae7c · GitHub](https://github.com/SlicerDMRI/SlicerDMRI/actions/runs/6699507556/job/18203755131?pr=191#step:8:1519)

However, as I’ve realized locally, some of those tests launch Slicer’s GUI components, and thus fail in the GitHub headless testing environment. I’ve seen that the test command contains a number of flags, e.g.  
[ENH: Test build · SlicerDMRI/SlicerDMRI@576ae7c · GitHub](https://github.com/SlicerDMRI/SlicerDMRI/actions/runs/6699507556/job/18203755131?pr=191#step:8:1505)

Including e.g. a `--no-splash`.

I am wondering whether tests we can completely avoid launching Slicer’s GUI parts, or whether this is the case already, and if tests fail, it is because they genuinely launch GUI parts (within the context of the extension, maybe due to some design choices). I am asking this to save installing `xfvb` (and spending time interacting with GHA to see if the steps work) if possible.

Even when a display is available, I’d say that it is not desirable to launch GUI parts.

Thanks.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [October 31, 2023, 3:55pm UTC](https://discourse.slicer.org/t/testing-without-launching-graphical-components/32506/2 "2023-10-31T15:55:28Z")

</div>

The first failing test seems to be due to this error:

> This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

You might need to install these:

[https://slicer.readthedocs.io/en/latest/user\_guide/getting\_started.html#debian-ubuntu](https://slicer.readthedocs.io/en/latest/user_guide/getting_started.html#debian-ubuntu)

> [@jhlegarreta](#):
>
> Even when a display is available, I’d say that it is not desirable to launch GUI parts.

It’s fine t have both kinds of tests, with and without the GUI, but as a general rule the tests that involve the GUI are more comprehensive and detect a wider variety of regressions, so explicitly running them as part of any CI is preferred. Using xvfb or docker are options to make this seamless.

---

<div class="post-metadata">

**Author:** ![jhlegarreta](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jhlegarreta/32/66542_2.png) [@jhlegarreta](https://discourse.slicer.org/u/jhlegarreta)\
**Post date:** [October 31, 2023, 8:34pm UTC](https://discourse.slicer.org/t/testing-without-launching-graphical-components/32506/3 "2023-10-31T20:34:15Z")

</div>

Thanks for answering, Steve.

> [@pieper](#):
>
> You might need to install these:
> 
> [Getting Started — 3D Slicer documentation](https://slicer.readthedocs.io/en/latest/user_guide/getting_started.html#debian-ubuntu)

`libxcb` is being installed: [ENH: Test build · SlicerDMRI/SlicerDMRI@d841568 · GitHub](https://github.com/SlicerDMRI/SlicerDMRI/actions/runs/6707883768/job/18227432404#step:4:75)

and there is a symlink already:  
[ENH: Test build · SlicerDMRI/SlicerDMRI@9c6c873 · GitHub](https://github.com/SlicerDMRI/SlicerDMRI/actions/runs/6711676171/job/18239570693#step:5:13)

So the only chances seems to use `xvfb`. Hoping that solves the issue:  
[ENH: Test build · SlicerDMRI/SlicerDMRI@5e56b79 · GitHub](https://github.com/SlicerDMRI/SlicerDMRI/actions/runs/6711729063/job/18239746275?pr=191)
