-
-
Notifications
You must be signed in to change notification settings - Fork 801
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
Added support for test hierarchies #4135
Comments
PS. There may be a way to work around that second point (untested). Try this: create a 2nd |
Regarding the "what is included for building tests" question: I've also found it weird that I wasn't able to include files from the |
@Adrian-Samoticha this is what I ended up doing; though there is a (discouraged) optional platformio.ini flag to also include the src into the tests; see https://docs.platformio.org/en/latest/plus/unit-testing.html#unit-testing-shared-code and https://docs.platformio.org/en/latest/projectconf/section_env_test.html#id6 . |
Guys, thank you so much for your feedback and comments. Let us summarize your requests:
Did I miss something? |
So there will be two ways to test?
I'd be fine either way, but this might lead to quite a bit of confusion. |
No, the workflow will be the same. |
Guys, thanks for your feedback on PlatformIO Unit Testing. We refactored our unit testing engine from scratch. A lot of sweet things are coming soon. See https://github.com/platformio/platformio-core/milestone/94 and https://github.com/platformio/platformio-core/blob/develop/HISTORY.rst Summary of what has been done:
Please upgrade to the latest PIO Core via Please also review https://github.com/platformio/platformio-core/milestone/94 , did we miss something? |
All of the tests are now prefixed with 5.2.5
6.0.1
|
Your thoughts? |
The (Those options would need to continue to work with directory names because providing those on the command line with shell tab completion is useful.) That will work until someone tries to do |
I'd vote for a single choice. Better get used to one long-term convention, IMO. Perhaps check for the mistake and give a clear notice? |
I finally got the time to get into the details of how to use the unit testing part of PlatformIO. First, many thanks for a super nice feature :) .
A few comments below. Sorry for the length, this is really because I love this feature and would love to see it be even better if it can be that I write something so long, so please take it as compliment not criticism :) .
the "what is included for building tests" question
It was quite confusing to me at first that plaformio unit testing does not use any of the files / headers in src and include. After a bit of confusion, I found the platformio web page documenting that unit testing by default only uses the lib content, and that a (discouraged) platformio.ini flag is needed to also use what comes from the src. This is the kind of thing that I was very confused about - I know "a posteriori" that I should have read the documentation in more details, but just wondering if this information may be added to the readmes of the src and include folders of each project :) .
the "tests folders need to be at the root of test" question
Another thing I was a bit confused about is that the tests always need to live in the "root" of the test folder. What I mean is that it is ok to have a structure:
but that the following structure fails to run tests, complains about multiple setup and loop functions etc, and that was confusing for me at first:
Having a possibility to have a bit of hierarchy would maybe be convenient though - for grouping stuff by category etc. Would it maybe be an option to allow the user to put a .test_hierarchy file or similar in folders that are not the root of a test case, but an "organization level" for a set of tests? Let me know if this is unclear. Maybe there is a better strategy, too.
the "bad tests setup" question
I first set up my tests wrongly, and then the test suite was not failing, just freezing. This was also very confusing. The issue was: tests need to be within a "RUN_TEST()" command and not just "natively", i.e.:
This is the kind of stupid mistake that happens, and is was very confusing to me that stuff just froze, without any meaningful error message or else... Wondering if there would be a way to catch this at compile time.
the caching question
Would it be possible to perform caching of all tests with all their dependencies etc individually and in "parallel" of the src, so that it is fast to run and re run tests and project building / upload back and forth? I think I observed the following behavior:
Can you confirm that this is well the behavior that is happening at the moment and that I am not missing something? :)
What about / would it be possible to set things so that, for example, both the src build and test(s) build(s) get cached "side by side" of each other, so that one can have fast builds in all cases even switching back and forth? I (and most people today :) ) have plenty of disk space, so I would not mind if the platformio build cache for a project is real 1 + N platformio build cache folders, with 1 src cache and N individual test caches (1 for each test). Of course if there can be an even better strategy that would be great too :) .
The text was updated successfully, but these errors were encountered: