I am dealing with the following (simplified) test report obtained from NUnit and I am trying to deserialize it
{
"test-suite": {
"@type": "TestSuite",
"test-suite": [
{
"@type": "Assembly",
"test-suite": {
"@type": "TestSuite",
"test-suite": [
{
"@type": "TestSuite",
"test-suite": {
"@type": "TestFixture",
"test-case": [
{
"@id": "1024"
},
{
"@id": "1025"
}
]
}
},
{
"@type": "TestSuite",
"test-suite": {
"@type": "TestFixture",
"test-suite": {
"@type": "ParameterizedMethod",
"test-case": [
{
"@id": "1018"
}
]
}
}
}
]
}
}
]
}
}
The problem is, if you notice, that the test-suite key is used to contain both the following types: either a test-suite, or an array of test-suite(s).
There's no logic to it as it depends of the assemblies and the organization of the tests within them.
How do I write the receiving json objects that can handle all the possible cases ?