Closed Florin-Popescu closed 3 years ago
For reference, Unity ships with optional fixtures to allow exactly this usecase (https://github.com/ThrowTheSwitch/Unity/tree/master/extras/fixture), the resulting binaries can then be called with -n test_name
.
Thanks for the suggestion. Started switching to fixtures on my personal project and using that as test grounds for adding support for fixtures to this extension.
Future v0.0.8 will add support for fixtures by 2 new extension settings:
testExecutableArgs
: to pass arguments to test exes when running them. Tests written with the fixture library don't report anything for a Pass by default, so can't tell if a test passed or was not run. Passing -v
to tests fixes this and this setting could be used more broadly too.testExecutableArgSingleCaseRegex
: to tell the extension how to add the test case's name to the exe to only run that test case. With Unity fixtures would be set to -n $1
to replace $1 with the test's name, but who knows if there are other custom formats out there, so that could be supported too. If empty, the extension would default to current approach of running the entire test file when a single test case is run from the UI.Think I would maybe add an easier to use unityFlavor
setting with options regular
, fixtures
or custom
off of which these settings are deduced. Some of these settings and other future ones maybe only used for custom
.
Investigate the possibility to pass test nr to executable if only a single test was requested to be run instead of the entire file.
This would mean a vscode setting for regex for parameter passed to executable along with test nr. I.e. test.exe -test 5 to only run 5th test in file. Or pass the actual test function name (same as in the UI) to the exe.
Choose between test nr or function name approach based on how the future testing API will work for vscode (are tests guaranteed to always have the same order in the file - i.e. not user orderable or hideable)
Then it's up to the exe to implement or ignore this.