You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great! Thanks for your work. Is it possible, btw, to customize the test case names? Right now, the way we've set things up gives us really similar test case names, since we have multiple nested data directories. I'd like to say "hey, generate the test case names only from the last 3 segments of the path" or something.
When you have tests that access multiple nested directories in a folder, irrespective of whether they're in a subfolder or in another folder outside of the crate, as described in #205, if you have nested folders for the globbed files, you will soon see patterns where you get test cases with the exact same name, because the "unique" part of the test case is truncated off in the file name.
This could perhaps be resolved with an optional parameter for segment: u8, which takes the last few directory levels to generate this, and the onus of readability is left to the user. Of course, the depth will have to be in reverse, if you have a file /home/user/data/more-data/nice-little-folder/case_0/subcase_10/file.yml, and you give a segment=3, the code should use case_0/subcase_10/file.yml. I'm open to alternate solutions on this, as long as it is possible to ascertain which test case failed.
The text was updated successfully, but these errors were encountered:
+1, I want to see some customization for the test names defined under the #[files] macro.
Keeping the last components: u8 path components would suffice but I can imagine a use case, where it is desirable to include components starting at a given path, so maybe that's a more general solution.
For example, if I have the following directory structure:
I would like test names to include only the differing components of the path. Either the default should trim common path prefix or the user would have to specify such behaviour like this:
trim_path_prefixes([...]) would accept an array of prefixes to trim: each prefix from this array would be compared against each test case path and trim the prefix on match. Trim at most one prefix from a path and don't change the test case path if none of the prefixes match.
Optionally, trim file extensions.
@la10736 what do you think about such proposal? I am willing to do the implementation but I need a second brain to bounce ideas off.
Following up from #205:
When you have tests that access multiple nested directories in a folder, irrespective of whether they're in a subfolder or in another folder outside of the crate, as described in #205, if you have nested folders for the globbed files, you will soon see patterns where you get test cases with the exact same name, because the "unique" part of the test case is truncated off in the file name.
This could perhaps be resolved with an optional parameter for
segment: u8
, which takes the last few directory levels to generate this, and the onus of readability is left to the user. Of course, the depth will have to be in reverse, if you have a file/home/user/data/more-data/nice-little-folder/case_0/subcase_10/file.yml
, and you give asegment=3
, the code should usecase_0/subcase_10/file.yml
. I'm open to alternate solutions on this, as long as it is possible to ascertain which test case failed.The text was updated successfully, but these errors were encountered: