vscode-python-test-adapter icon indicating copy to clipboard operation
vscode-python-test-adapter copied to clipboard

Hierarchical grouping

Open TommasoBendinelli opened this issue 4 years ago • 9 comments

Hello, It is a way to have a deeper than two level hierarchy in the explorer? For instance something as Folder as top root, File Name as second level, Class name as third level, and unit test as fourth level.

Best, Tommaso

TommasoBendinelli avatar Jun 03 '20 11:06 TommasoBendinelli

@TommasoBendinelli Thank you for the issue! I will consider some options, but I believe, it can lead to a lot of unnecessary levels. What kind of framework are you using? And if it is possible, please, provide an example of your directory structure.

kondratyev-nv avatar Jun 04 '20 19:06 kondratyev-nv

Hello, I am using a unittest and I am working with a project that consist of three modules: a model, an algorithm to control that model and a visualisation tool to visualise the results. So I subdivided my test folder in three subfolder (model, algorithm and visualisation tool). The test exploring interface is a bit confusing because I have so many tests, and with a first sub group with folders would be really helpful

TommasoBendinelli avatar Jun 05 '20 06:06 TommasoBendinelli

This issue is very pronounced when using pytest.

With pytest, the label appears to be the directory of the test module. For long test module names, the tree view will truncate the label so unless you have globally unique test module names it can be impossible to determine which package you are looking at. The default view in the native vscode testing tree is to group by directory/package.

eddawley-noyo avatar Oct 14 '20 15:10 eddawley-noyo

++ to this. The proposed feature is crucial to me, especially for the parametrized pytest units. The general Python extension already handles it, but with this extension what I see is as below, which is outright unusable.

image

meakbiyik avatar Jan 11 '21 10:01 meakbiyik

@meakbiyik Thanks for reporting this. I believe it's slightly different from the original issue and kind of easier to resolve. I've just published a new version 0.6.6 that will group parameterized tests under a suite node. Please, update and let me know how it works for you.

About the test hierarchy for files, I'm trying to experiment a bit, but it will be helpful if anyone can show real-world examples of file structure and a desired tree in the Test Explorer.

kondratyev-nv avatar Jan 20 '21 12:01 kondratyev-nv

@kondratyev-nv works perfectly, thanks! Time to add this extension to the recommended ones in vscode 😃

meakbiyik avatar Jan 20 '21 14:01 meakbiyik

I still think it would be great to organize tests by their folder hierarchy. I have a tests directory with subfolders unit, integration and system. It would be super useful to be able to start only one of the test types separately. I would be willing to submit a PR if you could point me into the right direction.

wackazong avatar Apr 06 '21 16:04 wackazong

@meakbiyik Thanks for reporting this. I believe it's slightly different from the original issue and kind of easier to resolve. I've just published a new version 0.6.6 that will group parameterized tests under a suite node. Please, update and let me know how it works for you.

About the test hierarchy for files, I'm trying to experiment a bit, but it will be helpful if anyone can show real-world examples of file structure and a desired tree in the Test Explorer.

What is a suite node? An example would be greatly appreciated!

etse1288 avatar Oct 20 '22 02:10 etse1288

Note that such a hierarchical grouping per directory would also solve #228.

My real-world example is GraphQL-core where the tests are separate, but grouped in sub-packages for each sub-packages they are testing. The native Python test runner shows the file level hierarchy I would expect.

Cito avatar Apr 21 '24 09:04 Cito