Skip to content

Enable (access modifier) internal ICollectionFixture classes #833

@johncrim

Description

@johncrim

Based on some testing, it appears that xunit does not support using a class that implements ICollectionFixture<FixtureType> from another assembly. This seems reasonable, because test collections are confined to a single assembly; and supporting discovery in any available assembly will almost surely have an undesirable perf impact.

Given this limitation, there will be cases where the collection fixture class is duplicated in multiple test projects - same signature, possibly same name, different namespace. In order to avoid conflicts, it would be nice if internal collection fixture classes could be used (they cannot currently be used). This seems consistent with the definition of a test collection to always be within an assembly. Eg:

[CollectionDefinition("MyTestCollection")]
internal class MyTests() {
    ....

Alternatively, it would be nice to link to the collection definition type from the test class (instead of using string matching), eg:

[CollectionDefinition(typeof(DatabaseIntegrationTestCollection))]
public class MyTests() {
    ....

which would presumably allow using test collection fixture definitions from other assemblies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Docshttps://xunit.net/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions