Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for doctest #4240

Closed
1 task done
jcw opened this issue Apr 22, 2022 · 5 comments
Closed
1 task done

Add support for doctest #4240

jcw opened this issue Apr 22, 2022 · 5 comments

Comments

@jcw
Copy link

jcw commented Apr 22, 2022

  • Feature Request.

The "doctest" unit test framework is a variant of "Catch2", but much simpler (and faster). I've been using this on native builds for some time now. For an example, tied into PIO for native, but still using Unity for embedded tests, see https://git.jeelabs.org/monty/tree/test?h=v1.6

See also doctest/doctest#506 which tries to run Doctest on embedded.

The key benefit, as with Catch2, is the amount of info you can see when tests fail, i.e. a test such as CHECK(abc == 42); then the actual value of abc will also be reported. Better still, you can capture other expressions tp print out, only on failure. This is such a game-changer that I've been going out of my way to test as much as possible on native (always a good strategy, of course).

If nothing else, I would be nice to support mixed doctest/unity testing, but supporting doctest on embedded would be even more powerful.

(This feature request was previously mentioned at #2185 (comment))

@ivankravets
Copy link
Member

Thanks for the feature request. Please re-test with pio upgrade --dev.

A new docs will be ready soon at https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/doctest.html

@Di3mex
Copy link

Di3mex commented May 9, 2022

@ivankravets Is it possible to use the VS Code GUI to run the tests? For example via the TestMate extension?

@ivankravets
Copy link
Member

Which features from that extension are the most important for you? You can use that extension for "native executables" but not for the embedded.

@Di3mex
Copy link

Di3mex commented May 9, 2022

image
Right now I cannot use the Test Explorer from Vs Code. I would like to be able to use the GUI. It doesn't have to be via the TestMate extension. It just seemed like it would/should work through the Extension.

I also really would like to be able to simply press the debug unit tests feature from withing the GUI.

From previous experience with integrated unit testing framework in IntelliJ / AndroidStudio I really miss the integrated GUI overview tables that would show you the list of the tests, allow you to run individual (failing) tests, debug a specific test.

Overall the unit testing experience is quite slow and cumbersome on PIO in VsCode, so I am really excited to see some advancements in a more modern unit testing direction! Thanks for the support and work on that!

@ivankravets
Copy link
Member

Could I ask you to file a new issue at https://github.com/platformio/platformio-vscode-ide/issues ? I'll provide some hints. Also, please copy your latest comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants