Skip to content

Using Decorator with xUnit #551

Closed Answered by kunalashar25
kunalashar25 asked this question in Q&A
Discussion options

You must be logged in to vote

I made quite a few changes and it got resolved in the end, one thing that help to start debugging was adding Debugger.Launch(); call in Initialize() so I could see logs while building the project.

Above code that I shared, doesn't work for xUnit and it throws error, correct approach is as below

var attribute = new CodeAttributeDeclaration("Xunit.TraitAttribute",
                        new CodeAttributeArgument(new CodePrimitiveExpression("Category")),
                        new CodeAttributeArgument(new CodePrimitiveExpression($"{value}")));
testMethod.CustomAttributes.Add(attribute);

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@kunalashar25
Comment options

@304NotModified
Comment options

@kunalashar25
Comment options

Answer selected by 304NotModified
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants