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

Theory-like attribute at class level? #2050

Open
onkarjit opened this issue Nov 11, 2019 · 2 comments
Open

Theory-like attribute at class level? #2050

onkarjit opened this issue Nov 11, 2019 · 2 comments

Comments

@onkarjit
Copy link

onkarjit commented Nov 11, 2019

Does xUnit support something like theory attribute but then at the class level which should automatically apply to all the test methods in the test class?

My system has 4 different role. Each test method should be tested for each role. I currently accomplish this by using the Theory attribute above the test method.

Right now I have to decorate each test method individually with the Theory attribute. It would be much better if I could just decorate my classes with the Theory attribute and if a method needs to override the Theory attribute at the class level it should provide its own Theory attribute.

@onkarjit onkarjit changed the title Something like theory attribute at class level? Theory-like attribute at class level? Nov 11, 2019
@ChrisMissal
Copy link

@onkarjit Sounds like you might be able to use a ClassFixture.

@onkarjit
Copy link
Author

onkarjit commented Dec 3, 2019

@onkarjit Sounds like you might be able to use a ClassFixture.

If I understand ClassFixture correctly it won't execute the same test method multiple times for different roles that I have, like how the theory attribute does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants