Skip to content

Consider an InternalsVisibleTo-type Attribute for Locating Testing Projects #50

@Mike-E-angelo

Description

@Mike-E-angelo

I am running into a scenario in a solution with many projects (about 40 of them) where the regex location seems to fail me.

That is, in this scheme, there seems to be overlap with two of the scenarios described in the wiki. To start, there are many projects that do not have a dedicated test project based on namespace/project, but they all share one central one (usage #3). Yet, there are still others that do have their own dedicated projects based on a namespace (usage #1).

So, a combination of scenarios one and three as described in the Wiki if I understand correctly, and a result TestCop never seems to know which one to use when I try to create a test in an assembly that doesn't conform to the configuration applied in settings.

It got me thinking: what if there was a way to somehow "hint" to TestCop to look in a particular project per-project, much like how the InternalsVisibleTo attribute works.

It could work by pointing TestCop to the project and an optional folder, if supplied.

So, in the case of the project Application.Composition as an example, it could look in an Application.Testing project, in the Composition folder with the following "hint" attribute applied to its assembly:

[assembly: TestingAssemblyHint("Application.Testing", "Composition")]

Pressing CTRL-G, CTRL-T on Application.Composition.NewComponent, Application.Composition with the above attribute applied to its assembly/project would point it to create the test file located at Application.Testing.Composition.NewComponentTests, Application.Testing.

This could also be an MSBuild project property as well. This might actually be a better solution to do so as it won't compile into the assembly (but that is not a big price to pay if it means deterministically getting tests made!).

Anyways, I wanted to suggest it to see how difficult it would be, and/or if there is something else that I am not considering here. Thank you for any assistance/consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions