X99
March 21, 2020, 10:14pm
1
Hi.
As some of you might know, I created a full-fledged CI/CD for gitlab and sonarqube. See here .
My tests all run fine, but I’d like SonarQube to be aware of them. So far, code coverage indicator is stuck to 0
Can anyone help?
Thanks a lot!
1 Like
Could you provide more details?
Thank you so much for amazing guide! We will spread out it in our social network soon.
1 Like
X99
March 24, 2020, 12:10am
3
Thank you so much for amazing guide! We will spread out it in our social network soon.
What an honor! Thank you so much!
Back to the topic, here are the details. I have a projects that has unit tests. I use pio test
, works great. But in this project, “desktop” tests are kind of irrelevant as many of these are tied to the platform. For example, some of these tests a feature that writes to EEPROM.
So I can’t use gcov
, as I don’t compile desktop binaries and, AFAIK, can’t generate unit test coverage informations to be sent to SonarQube.
If needed I’d love to provide you with gitlab/sonar access to the mentioned project if for some reason you need to dive further in. Let me know it that option suits you.
X99
June 9, 2020, 9:36am
4
Hi @ivankravets , any follow-up on both subjects?
Thank you
1 Like
Do you mean this feature request?
opened 05:38PM - 29 Jul 19 UTC
closed 04:19PM - 23 Apr 22 UTC
feature
unit testing
I was able to create a set of Unit Tests with PlatformIO and run them as native … within a docker container. I also managed to run those tests as port of my build pipeline on Azure DevOps. All looks pretty good.
### Thank you so much for building this amazing tool!!! ###
Only thing which nags me is that failing unit tests make my build fail with no additional information available before I dig into the log files.
It would be amazing, if I could extract the build results into a test result file in a JUnit format or something alike which I then could use to provide my build system with additional information.
I'm wondering if something like this is build in right now or if I have to build something on my own.
# Useful links
- https://llg.cubic.org/docs/junit/
- https://help.catchsoftware.com/display/ET/JUnit+Format
X99
June 11, 2020, 7:20pm
6
Yes, and this (kind of old) one too:
opened 09:08PM - 20 Jan 17 UTC
feature
# Tutorials
- https://piolabs.com/blog/insights/test-coverage-on-unit-testing… .html
- https://blog.leon0399.ru/platformio-coverage-github-actions
--------
Hi Ivan,
I searched for this kind of topic and didn't find anything but let me know if this is a duplicate.
I have my Transition library being tested on Travis using my ArduinoFrameworkFake library which has been working well since you gave me directions on how to import the library.
I'd now like to gather some information regarding coverage so that I can identify areas where I am not testing my code sufficiently. I tried using the build_flags section in platformio.ini to pass ```--coverage``` but was met with a lot of linker errors that I tried (unsuccessfully) to resolve.
Here's a few of the combinations of options I tried using
```-g -O0 --coverage -fPIC -shared -Wl,-fprofile-generate -Wl,-shared -Wl,-fPIC```
```-fprofile-arcs -ftest-coverage -fprofile-generate -Wl,-lgcov --coverage```
I am successfully generating coverage using: https://github.com/r89m/Transition/blob/master/.travis.yml#L56
which is giving me the output I'd like (https://coveralls.io/jobs/22116632) but I'd love to be able to do something along the lines of pio test --coverage or similar and generate the necessary gcno and gcda files.
Any help would be appreciated.
Richard
1 Like