Dart-code: Support "Run all Tests" for projects in sub-folders

Created on 11 Feb 2019  ·  5Comments  ·  Source: Dart-Code/Dart-Code

Hi, I have the following folder structure

Solution\project1test
Solution\project2test

I open the solution at the root (solution) and select "Run all tests" and I get the following message
"unable to find any test folders".

Is this supported or do I need to open visual studio at the project level to use "Run all tests"?

in testing is enhancement

Most helpful comment

This was fixed in #1792 which added support for projects in sub-folders and scanning further down. I did find another bug (#2377) while testing it today though, so that's fixed for the next version.

All 5 comments

Is this supported or do I need to open visual studio at the project level to use "Run all tests"?

Right now we just look for /test folders in the project root. I think it's a reasonable request to support though, since we have started supporting projects-in-subfolders better recently.

As a potential workaround, can you try opening your projects as "workspace folders" instead? Eg. click File -> Open then navigate to your Solution folder, and shift-click to select both project1 and project2 folders. This will open both of the folders in the explorer tree, but each one will be its own workspace folder.

Yes, opening the projects in a workspace seems to do the trick (I've not used workspaces before, I will have a read up on them!) It seems to run all tests from all projects so I think that works for me :-)

Great, thanks for confirming!

Workspace folders allows you to open multiple folders from entirely different locations on disk, but it's also a convenient way to tell VS Code (or extensions) that "these are projects". When you open just a parent folder, the only way for us to know which folders are projects is to scan them looking for pubspecs (and this means walking the whole tree). As such, we only do this in some places, and tend to only go 1 or 2 levels deep.

In this case (Run All Tests) we weren't walking the tree at all, so we only find test folders directly inside workspace folders. However I'll keep this issue open to support at least looking one-level down, since I think we should be able to support that (and most people tend to open the parent folder directly, as you did originally).

Great, workspaces sound a little more explicit and I quite like that! Many thanks Dan

This was fixed in #1792 which added support for projects in sub-folders and scanning further down. I did find another bug (#2377) while testing it today though, so that's fixed for the next version.

Was this page helpful?
0 / 5 - 0 ratings