Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5.6k
Help get System.Text.Json test coverage to 100% (or close to it) #32341
Copy link
Copy link
Closed
Labels
area-System.Text.Jsonhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedincrease-code-coverageTracking need to add more test and increase code coverage of a componentTracking need to add more test and increase code coverage of a componenttest-enhancementImprovements of test source codeImprovements of test source code
Milestone
Description
Metadata
Metadata
Assignees
Labels
area-System.Text.Jsonhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is mergedincrease-code-coverageTracking need to add more test and increase code coverage of a componentTracking need to add more test and increase code coverage of a componenttest-enhancementImprovements of test source codeImprovements of test source code
Let's try to get the test coverage of all components of the JSON stack closer to 100%, where feasible.
We are in pretty good shape (well over 90%+). It tends to be much easier to maintain the bar once we hit 100% since any drop becomes clear/visible.
One component that is effectively at 100% is
JsonElement. Let's see if we can get there for the rest.That said, we shouldn't bend over backwards to try to get to 100% for things like testing all the conditions of a
Debug.Assertsor return line after a throw. If some code is unreachable or not used, update/delete it.Some test improvements are relatively easy to do, so I encourage folks who want to help contribute to
System.Text.Jsonto start there. Others might require more work to bridge the test gap.Here's our current JSON test coverage numbers for .NET Core (including outerloop which takes ~10 minutes to generate):
report.zip
Steps to generate:
Following the steps from https://github.com/dotnet/runtime/blob/master/docs/workflow/building/libraries/README.md#quick-start
Here are some good starting points:
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonDocumentOptions.cs
Line 12 in f5874b0
runtime/src/libraries/System.Text.Json/src/System/Text/Json/JsonHelpers.cs
Line 12 in f5874b0
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs
Line 17 in f5874b0
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfo.cs
Line 14 in f5874b0
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfoOfTTypeToConvert.cs
Line 14 in f5874b0
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Reader/JsonReaderHelper.cs
Line 13 in f5874b0
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.HandleMetadata.cs
Line 10 in 527adf2
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Line 15 in 527adf2
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/ArrayConverter.cs
Line 14 in 527adf2
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Collection/ConcurrentStackOfTConverter.cs
Line 11 in 527adf2
runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs
Line 14 in b95e523
cc @jozkee, @layomia, @steveharter