Analyzers 1.0.0 2022 August 1
Hello, 1.0.0!
Today we're shipping the first full release of the xUnit.net Analyzers package at 1.0.0
!
The first commit to the analyzers project happened almost exactly 6 years ago on August 31, 2016. Marcin Dobosz was working at CenturyLink Cloud with Jim & Brad. His goal was to help developers identify the most common issues found when writing tests with xUnit.net, using his coworkers as the guinea pigs. 😄
The first official release was 0.1.0
, which shipped the following May alongside the xUnit.net 2.3 Beta 2 release. This included 15 analyzers for test authors related to non-assertion usage by test authors (things like ensuring the correct number of parameters in [InlineData()]
usage) and 5 analyzers for test authors related to assertion usage (things like ensuring that you are passing the expected
and actual
values in the correct order).
In the intervening time between that first release and today, there were ten more public releases in the 0.x
version system, usually aligned with beta or RTM releases of the core framework.
With today's official 1.0 release, we now offer 28 non-assertion analyzers and 19 assertion analyzers, plus an entirely new category: 2 analyzers designed for developers who are writing extensions to the core framework.
As always, we'd like to thank all the users who contributed to the success of xUnit.net through usage, feedback, and code. 🎉
Release Notes
These release notes are a comprehensive list of changes from 0.10.0
to 1.0.0
.
General
- All analyzers were reviewed to ensure that the analyzer message contains not just "What was done wrong?" but also "How do I fix it?". This is in recognition that not all developers have access to editors that allow the user to run the fixers, and may only ever see the message via a command line build (like with
msbuild
ordotnet build
) that doesn't surface the documentation links. For example, xUnit1000's message used to read"Test classes must be public"
, but now reads"Test classes must be public. Add or change the visibility modifier of the test class to public."
.
Usage Analyzers
Fixed an issue with xUnit1010 to allow generic arrays as theory parameters. xunit/xunit#2075
Fixed an issue with xUnit1016 and xUnit1019 which were triggering inadvertently when there were member data elements with overridden names (even though the public one was legal). xunit/xunit#1968
Updated xUnit1020 to also ensure property getters are public.
Fixed an issue with xUnit1025 which was incorrectly triggering duplicates because empty arrays were being ignored. xunit/xunit#1877
Fixed an issue with xUnit1026 which was firing inappropriately when a parameter was used as an
out
value. xunit/xunit#1802Added xUnit1027 to detect and fix when test collection classes aren't public. xunit/xunit.analyzers#118
Added xUnit1033 to detect and fix test classes which are decorated with
IClassFixture
and/orICollectionFixture
but did not accept the fixture instance via the constructor. xunit/xunit#2068
Assertion Analyzers
Fixed an issue with xUnit2013 where it inappropriately suggests converting
Assert.Equal(0, arraySegment.Count)
intoAssert.Empty(arraySegment)
sinceArraySegment<T>
can throw an exception when calling.GetEnumerator()
. xunit/xunit#1970Fixed an issue with xUnit2014 where anonymous async methods which returned the result of
.ConfigureAwait()
were not properly detected. xunit/xunit.analyzers#126
Extensibility Analyzers
Fixed an issue with xUnit3000 where the fixer would crash on projects that only reference
xunit.abstractions
. The issue is still raised, but the fixer is not available (since the reference toLongLivedMarshalByRefObject
requires a reference toxunit.extensibility.execution
). xunit/xunit#1574 xunit/xunit#1575Updated xUnit3001 to allow it to generate a new constructor in addition to being able to update an existing constructor.