开发者

Execute TestSetup only some of the time?

开发者 https://www.devze.com 2023-01-02 09:00 出处:网络
Within one fixture is it possible to markup tests in such a way that the test-setup is only called for some tests and not for others?

Within one fixture is it possible to markup tests in such a way that the test-setup is only called for some tests and not for others?

[Test] public void TestWithoutSetup() { .. }
[Test] public void TestWithSetup() { ..开发者_如何学Go }

What would I need to do make the above work?


There's no attribute to accomplish what you want.

I would suggest refactoring your test cases into two separate classes that inherit base functionality from an abstract test class. Each test class can have its own setup method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号