NUnit doesn't find tests in assembly

前端 未结 3 955
时光说笑
时光说笑 2021-01-14 05:48

I inherited an assembly with MSTest, but these tests were run using nunit-console on the build machine (not sure how it worked). So I decided to sort it out and change them

3条回答
  •  不要未来只要你来
    2021-01-14 06:03

    Check:

    • Is the class public?
    • Does it have a public parameterless constructor (e.g. the default one if you don't specify any other constructors)
    • Does it have the [TestFixture] attribute at the class level?
    • Is each test public?
    • Does each test have the [Test] attribute?
    • Is each test parameterless?

    I believe some versions of NUnit were able to find tests based on their names, e.g. TestFooBarBaz() without the [Test] attribute, but I don't know what the state of this is now - it could explain the discrepancy though.

提交回复
热议问题