GithubHelp home page GithubHelp logo

Comments (4)

testplatform-bot avatar testplatform-bot commented on June 10, 2024

✅ Successfully linked to Azure Boards work item(s):

from testfx.

Evangelink avatar Evangelink commented on June 10, 2024

From @AliveDevil

Ah, so

[TestClass]
static class GlobalState {
 [AssemblyInitializer] …

would work? If this is the case, the wording "non-abstract or static type […] should contain at least one test method" should not include "static" (or rephrase that it applies to non-abstract and non-static / non (abstract or static)), then the analyzer can be stricter for these types.

from testfx.

Evangelink avatar Evangelink commented on June 10, 2024

I agree with your comment @AliveDevil, the wording is not ideal and maybe we should only mention the exception cases in the rule documentation page but not on the analyzer description.

The following examples are cases where the rule should not trigger:

  1. Test class with no tests but some [AssemblyInitialize] or/and [AssemblyCleanup] methods. Usually this type is static and doesn't contain anything else but some helpers but this is not hard constraint so it's probably easier to just check the presence of the attributes mentioned.

2. Test class with some [ClassInitialize] or [ClassCleanup] with inheritance mode. The ideal case is that this class is abstract but this is not a requirement so once again we could be looking only at the presence of the attributes.

Note that the rule could apply to derived types from [TestClass] because the related virtual method forces to return derived or instances of [TstMethod].

from testfx.

Evangelink avatar Evangelink commented on June 10, 2024

Correction for point 2, the class doesn't need to be marked as [TestClass] so we only need to avoid raising for case 1.

from testfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.