Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
412 views
in Technique[技术] by (71.8m points)

unit testing - What is the difference if TestFixture attribute is used or not

I cant see any difference in behaviour for class that has TestFixture attribute and not. All TearDown and SetUp are working in the same way. Is there any reason except semantics for this attribute usage?

question from:https://stackoverflow.com/questions/8400873/what-is-the-difference-if-testfixture-attribute-is-used-or-not

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Is purely a convenience, beginning with NUnit 2.5, if a class satisfies the conditions to be a test fixture and specifies at least a method marked with Test, TestCase or TestCaseSource than that class is treated as a test fixture.

The TestFixture attribute is required however for parameterized or generic test fixture because in that case you also specify additional information through the attribute (parameters/concrete types).

More information about the specific requirements is available at TextFixtureAttribute (NUnit 3 Documentation) and TestFixtureAttribute (NUnit 2.0 / 2.5)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...