Florin-Popescu / vscode-unity-test-adapter

Unity Test Adapter Extension for VS Code
MIT License
5 stars 4 forks source link

Allow executing of a single test from a file #6

Closed Florin-Popescu closed 3 years ago

Florin-Popescu commented 3 years ago

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.

NovaNekmit commented 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.

Florin-Popescu commented 3 years ago

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:

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.