Description
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.
+------------------+--------+--------+--------+
| Module | Line | Branch | Method |
+------------------+--------+--------+--------+
| System.Text.Json | 94.04% | 91.22% | 98.05% |
+------------------+--------+--------+--------+
+---------+--------+--------+--------+
| | Line | Branch | Method |
+---------+--------+--------+--------+
| Total | 94.04% | 91.22% | 98.05% |
+---------+--------+--------+--------+
| Average | 94.04% | 91.22% | 98.05% |
+---------+--------+--------+--------+
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
1) build.cmd clr+libs -rc Release (this step takes ~10-20 minutes)
2) cd src\libraries\System.Text.Json\tests
3) If you want a quick report (~2 minutes), don't run the outerloop tests.
a) dotnet build /t:Test /p:Coverage=true /p:BuildTargetFramework=net6.0
b) dotnet build /t:Test /p:Coverage=true /p:BuildTargetFramework=net6.0 /p:Outerloop=true
Here are some good starting points:
- JsonDocumentOptions
- JsonHelpers
- JsonClassInfo
- JsonPropertyInfo
- JsonPropertyInfoOfTTypeToConvert
- JsonReaderHelper
- JsonSerializer
- JsonSerializerOptions
- ArrayConverter
- ConcurrentStackOfTConverter
- JsonConverterOfT.cs
cc @jozkee, @layomia, @steveharter