Comments (4)
✅ Successfully linked to Azure Boards work item(s):
from testfx.
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.
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:
- 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.
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)
- Unify how attributes are handled and how tests are discovered HOT 1
- Wrong year in docs/Changelog.md for 3.4.x releases HOT 1
- 3.4 is not working with Fakes HOT 13
- ConsiderEmptyDataSourceAsInconclusive throws to catch the exception on the next line
- Release notes for 3.4.0 are pointing to the main branch and some links are broken HOT 1
- AssemblyCleanup executes after first test point in multi-test-point test run via Azure Devops Release pipeline VsTest Task when all tests are associated to the same TestMethod HOT 2
- MSTest 3.4.1 does not work with .net472 AND when using deployment item when running from Visual Studio HOT 1
- should settings parsing ignore invalid values? HOT 2
- MSTest.Sdk aspire feature doesn't reference released version
- mstest 3.4.1 does not discover a method from unit tests in visual studio when returning a Task with multiple frameworks HOT 4
- Use `ConcurrentDictionary` for attribute cache
- Move ReflectionHelper to PlatformServices
- Add a globally accessible TestContext.Progress logger HOT 1
- Missing NuGet packages for 3.4.2 release HOT 3
- dotnet run -- --help shows options for the hidden tools extensibility point
- ClassCleanup is not skipped when ignored and ClassInitialize is not present HOT 2
- Remove Usings.cs from samples HOT 1
- DataRows in UWP Release builds no longer works HOT 7
- A test method using Activator.CreateInstance that raises an exception is not failing and is showing a "Not Run" status.
- Filtering race conditions? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testfx.