Skip to content
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

Highlighting "why" a type fails test #105

Closed
brettpostin opened this issue Sep 15, 2022 · 5 comments
Closed

Highlighting "why" a type fails test #105

brettpostin opened this issue Sep 15, 2022 · 5 comments

Comments

@brettpostin
Copy link

In my tests I am outputting the types that fail the test. However what would be great is to identify the reason why that type fails the test.

e.g.

var result = Types.InAssembly(typeof(Foo).Assembly)
    .Should()
    .OnlyHaveDependenciesOn(new string[] { "Bar" })
    .GetResult();

Assert.True(result.IsSuccessful, GetFailingTypes(result));

It would be great to see the dependencies causing the violation. Is there any means to do that at present?

@BenMorris
Copy link
Owner

I'm afraid not - the whole execution chain is predicated on building up a list of types that pass or fail rules (see FunctionSequence.Execute()). It doesn't retain any other metadata around why a rule failed for each type.

@thomaseyde
Copy link

How can I vote for this as a feature request? I have struggled for two hour now to figure out why two simple types of mine fail.

@NeVeSpl
Copy link
Contributor

NeVeSpl commented Nov 8, 2022

Implementing that would require too many breaking changes, including performance profile/impact, thus I do not think that this will be ever implemented here. I have started the parallel project, that allows sending metadata alongside the type, and I have in mind this issue, but right now I do not have the motivation to push it forward.

@thomaseyde
Copy link

thomaseyde commented Nov 8, 2022 via email

@brettpostin
Copy link
Author

@thomaseyde we switched to ArchUnitNET, which according to nuget uses this project as a dependency and does report on failure reasons.

NeVeSpl added a commit to NeVeSpl/NetArchTest.eNhancedEdition that referenced this issue Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants