-
Notifications
You must be signed in to change notification settings - Fork 11
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
Think about hierarchies for test items #5
Comments
Another idea would be to add something like a @testfolder "Foo" begin
@testfolder "Bar" begin
@testitem "Something begin
end
end
end The rule would presumably be that a Could also be named |
First let me say thank you for developing this package. It's one of those packages where you immediately think: I didn't know I needed this but I really do! Reusing the file system does have a certain elegance and robustness. You may have already considered this, but as an alternative could the existing |
New idea: we conceptually change things so that each test item has a name/id and a label. The name/id can be hierarchical. If no label is specified, the name automatically becomes the label. The name/id can be specified either as a Implications would be this: @testitem "Foo" begin
end Here @testitem Foo label="Something else" begin
end Name is @testitem Bar.Foo begin
end The name is @testitem Bar.Foo label="Something else" begin
end Would be the obvious thing. And we would of course allow arbitrarily deep nesting: @testitem Foobar.Bar.Foo begin
end |
Currently I have not felt the need of another level of nesting besides that of the files, and actually having the files as the top labels for the test makes it very easy to visualize where the tests are. However, I do know that other packages have large files, and the list of tests can become complicated, thus I like the idea of allowing nesting by labeling. My doubt would be: If the ps: Another syntax alternative could be: @testgroup "Tests1" # (actually `@testset` sounds nicer, but may cause conflicts).
@testitem "Foo" <: Tests1 begin
end That would not allow arbitrary nesting, but neither does our type system :-D. |
Ah, I should clarify: my idea is that the file/folder type nesting we have already stays in place, this would just be an optional way to add more nesting below the file system nesting we already have. I completely agree, I really like having the file system structure in place. So this would also mean that if one has two files, In @testitem Foo.Testitem1 begin
end In fileB.jl` @testitem Foo.Testitem2 begin
end Then the hierarchy would look like this:
So the two |
Maybe unrelated, but I think it would be great if the |
+1 for doing the nesting by directory/file structure. this maps to what they do in golang, and that seems to work well enough for them! :) |
I'm ambivalent on the sub-file nesting, but it does seem like it could be nice, yeah! Either by having yet another grouping macro, or using nested names as you suggested. |
Note that we don't seem to be doing actual nested folder -> nested tests yet; for example, if I have 2 subdirectories in my test directory, each w/ their own i.e. each individual file w/ Whereas in go (which @NHDaly was referring to), has: so here we have the As far as I can tell, we need to restructure how we're providing testitems to the vscode request by utilizing the If I can figure out how to get a dev env setup to hack on the julia extension, I'll see if I can take a crack at making this change. |
Yep, I was more describing an aspiration ;) Not yet implemented, and definitely the I think this folder hierarchy thing could be implemented purely in the VS Code extension, essentially https://github.com/julia-vscode/julia-vscode/blob/d0d8c6b43fc7cf3f96cd41493e7a943829c421e1/src/testing/testFeature.ts#L295-L328 would just need to parse And we might then also need to check https://github.com/julia-vscode/julia-vscode/blob/d0d8c6b43fc7cf3f96cd41493e7a943829c421e1/src/testing/testFeature.ts#L414 to make sure it can deal with |
Any progress on this? I wanted to do @testitem "Set of tests" begin
f(x) = x
@testitem "Single part" begin
import ..f
f(1)
end
end but this didn't seem to work. I think according to https://en.wikipedia.org/wiki/Principle_of_least_astonishment it would be nice to have this since it's possible with |
So, I don't think we would ever allow nesting of But for now I think the low hanging fruit is to just properly implement a tree view for the folder/file hierarchy in the extension, that seems the first step. |
At the moment the hierarchy for test items is essentially the file system, and then a flat list of
@testitem
per file.Is that good enough? One really nice thing about this is that it is simple, plus we reuse an existing well established hierarchical structure, the file system, to order things. So right now I'm thinking that we probably don't want anything beyond that, but who knows...
One could also consider something like
@testitem "Level 1/Level 2/My test" begin end
, and then the hierarchy would be constructed out of these paths of names...The text was updated successfully, but these errors were encountered: