dvdnwk
1
There is a simple way to run all tests for given env:
It is actually calling /usr/local/bin/platformio -c clion test -e native
.
So, how about running a SINGLE test to speed up TDD process?
In CLI I can do:
pio test -e native --filter="native/DnLogger/Endpoint/test_PrinterLogger"
Is there a way to do something similar in CLion?
dvdnwk
2
For now I have created a script file run_test.sh
with
pio test -e native --filter="path/to/test_something"
I’ve also set up External Tools that runs the script.
Finally, I’ve configured a shortcut to run the external tool in Keymap
settings.
So… the current workflow is:
- Modify
run_test.sh
with the test I’m working with now
- Hit a shortcut to run it.
Kinda OK. I wish I could get rid of the run_test.sh
in favour of some native IDE functionality.
Plus, I don’t know why the output is not coloured the way it is in CLI:
dvdnwk
4
I don’t know.
But, coming from PhpStorm:
- you can use a shortcut or right-click in the test source to run/debug a specific test method:
- or all test methods from the test class:
- it shows up automatically in the build toolbar then
dvdnwk
6
The lack of colors was PIO’s [?] fault. I grepped the source code for ansi
and found PLATFORMIO_FORCE_ANSI
env var.
#!/bin/bash
export PLATFORMIO_FORCE_ANSI=true
pio test -e native --filter="native/DnLogger/Endpoint/test_PrinterLogger"
Now the colors work in the CLion’s output.
dvdnwk
7
Even better, with autorefresh of the test when files change: