-
-
Notifications
You must be signed in to change notification settings - Fork 792
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
Unity tests no longer show Serial output without verbose option #4276
Comments
Hi Anthony, Thanks for the report. Indeed, this is a feature, not a bug. We don't print all junk from the testing frameworks and provide you by default only valuable information. The So, what I propose. Allow passing multiple
Your thoughts? |
having all the building etc type messages be moved from -v to -vv / -vvv would definately help. |
Honestly though, it seems a bit of a pain, why the change? |
You can override it via |
Mmm, not yet convinced that this is an improvement over the v5 behaviour. How do I set -v in vscode? |
Thanks! The configuration option in INI has been removed. However, the multilevel verbosity is available for Meanwhile, you can declare custom target with We also plan to create a separate Test View. Please subscribe to this feature platformio/platformio-vscode-ide#3168 |
None of those really seem great though when all i want is to see the test output so i can add debugging output while developing new code, like it used to. I suppose the separate Test View might help, but its not available yet. |
I've run into the same issue. We write log output to The FYI the link included in the comment above doesn't seem to point to anything about the verbosity level?:
|
Yes, PlatformIO normalizes test results from multiple testing frameworks to the unified output. Typically, people don't use Unit Testing to debug their applications. If you need custom results output, please override https://github.com/platformio/platformio-core/blob/develop/platformio/test/runners/unity.py#L260 See https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/custom/index.html |
For me, that is the way people use this - write some tests and then using debug output to get the tests passing or to work out whats wrong when some change has inadvertently broken a test. Personally I prefer the v5 behaviour and wonder wouldn't something like a new "quiet" option have been a less disruptive change for those who don't want to see the output.
Can you explain that a bit more - how would I do that override? |
Just follow this example https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/custom/examples/custom_unity_library.html platformio.ini [env:myenv]
test_framework = custom test_custom_runner.py (put this file to the root of import click
from platformio.public import UnityTestRunner
class CustomTestRunner(UnityTestRunner):
def on_testing_line_output(self, line):
click.echo(line, nl=False)
super().on_testing_line_output(line) |
That gives:
Do I need an import or something for click? |
Sorry, updated the code above. I didn't test it. |
Thank you for this @ivankravets. I added an import click
from platformio.public import UnityTestRunner
class CustomTestRunner(UnityTestRunner):
def on_testing_line_output(self, line):
if super().parse_test_case(line) is None:
click.echo(line, nl=False)
super().on_testing_line_output(line) |
Thank you everyone! I agree that this change of behaviour is a little odd. I was also using unit tests to debug small pieces of code for my project, so I think it is a very valid use case. Thanks for providing a solution, works well for me. |
This solution looks fine to me. |
Doesn't seem to work for me with platformio 6.1.4 unless I use the TEST_MESSAGE macro (instead of say Serial.print()). And this is using the "-v" flag when running pio test. I also have the custom runner as mentioned above.. TEST_MESSAGE macro is defined under
|
Could you share your |
It turns out I only have to use TEST_MESSAGE in the main test loop. Serial.print() statements are fine from within the unit tests themselves. |
After an updated from v5 to PlatformIO Core, version 6.0.1 Serial output in tests no longer shows unless the verbose option is used.
For recreate see: https://community.platformio.org/t/unity-test-serial-print-output-gone/27800/3?u=torntrousers
The text was updated successfully, but these errors were encountered: