-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help get System.Text.Json test coverage to 100% (or close to it) #32341
Comments
I can pick up some of this work, so long as it'd be OK for a first contribution to the dotnet runtime. I've started on a couple in a draft PR (#32705), and will continue to work through them. |
@ahsonkhan I started looking into this and ran into an issue running the tests, which I then traced to the fact that the
|
@alexvy86 done; thanks for pointing that out. |
Do the build instructions need to be updated as well (step 1) or did that work as expected for you? I know there were some recent changes there too (cc @ViktorHofer). |
The build worked fine, it was only running the tests that wasn't working. |
I'm looking at testing portions of 2 ( |
@thall90 My understanding is that we should avoid using |
Sounds good. Thanks! |
* Remove unused method on JsonClassInfo (#32341) * Add test coverage for a couple of validation branches in JsonWriterHelper (#32341) Co-authored-by: Josh Schreuder <[email protected]>
@thall90 you still work in progress on JsonHelpers? if not, i hope to take it |
It looks like the steps to generate coverage report need to be updated. Parameters "-subsetCategory" are no longer available. New version: |
build.cmd clr+libs -c Release |
Hey guys. Wanted to get an actual coverage report, but the tests/report generating working sooo slow which confuses me a bit, I'm certain I missed smth and I'd appreciate an advice here. If it's important, then builds in both Debug and Release configuration are fine and take 'normal' time for such big code-base. |
hey @z77ma, what do you mean by slow? Do you have data to share? |
@z77ma @ViktorHofer it sounds like the runtime subset was built on Debug configuration. @z77ma did you build using the suggested configuration?
|
I updated the instructions in the original post of the issue: Steps to generate:
|
Hey all. |
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.Asserts
or 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.Json
to 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
The text was updated successfully, but these errors were encountered: