Ниже приведен мой документ json:
[
{
"line": 1,
"elements": [
{
"before": [
{
"result": {
"duration": 1363286,
"status": "passed"
},
"match": {
"location": "Hooks.init(Scenario)"
}
}
],
"line": 4,
"name": "List Size test",
"description": "",
"id": "test-list-size;list-size-test",
"after": [
{
"result": {
"duration": 82262,
"status": "passed"
},
"match": {
"location": "Hooks.closeAllwindows()"
}
},
{
"result": {
"duration": 127317,
"status": "passed"
},
"match": {
"location": "Hooks.embedScreenShot(Scenario)"
}
}
],
"type": "scenario",
"keyword": "Scenario",
"steps": [
{
"result": {
"duration": 4170752,
"status": "passed"
},
"line": 6,
"name": "def test\u003d\u0027{ \\\"mytest\\\":[ { \\\"test1\\\":\\\"abc\\\", \\\"test2\\\":\\\"bcj\\\" }, { \\\"test1\\\":\\\"abc\\\", \\\"test2\\\":\\\"bcj\\\" } ]}\u0027",
"match": {
"arguments": [
{
"val": "test\u003d\u0027{ \\\"mytest\\\":[ { \\\"test1\\\":\\\"abc\\\", \\\"test2\\\":\\\"bcj\\\" }, { \\\"test1\\\":\\\"abc\\\", \\\"test2\\\":\\\"bcj\\\" } ]}\u0027",
"offset": 4
}
],
"location": "APIStepDefs.def(StringBuilder)"
},
"keyword": "Given "
},
{
"result": {
"duration": 980309,
"status": "passed"
},
"line": 7,
"name": "I convert \"${test}\" to response",
"match": {
"arguments": [
{
"val": "${test}",
"offset": 11
}
],
"location": "UtilsStepDefs.i_convert_to_htf_response(String)"
},
"keyword": "And "
},
{
"result": {
"error_message": "java.lang.AssertionError: JSON PATH mytest LISTSIZE validation is failed . Actual ArrayList size is :: 2 Expected ArrayList size is :: 3\r\n\tat org.testng.Assert.fail(Assert.java:96)\r\n\tat com.ingenico.htf.generickeywords.assertions.JsonAssertions$13.performJSONAssertion(JsonAssertions.java:323)\r\n\tat com.ingenico.htf.generickeywords.client.apiclient.APIClient.assertJSONResponse(APIClient.java:335)\r\n\tat com.ingenico.htf.generickeywords.stepdefs.APIStepDefs.assert_JSON(APIStepDefs.java:127)\r\n\tat ✽.assert JSONPATH LISTSIZE(src/test/features/CheckListSize2.feature:8)\r\n",
"duration": 1293311,
"status": "failed"
},
"line": 8,
"name": "assert JSONPATH LISTSIZE",
"match": {
"arguments": [
{
"val": "LISTSIZE",
"offset": 16
}
],
"location": "APIStepDefs.assert_JSON(JsonAssertions,DataTable)"
},
"rows": [
{
"cells": [
"mytest",
"3"
]
}
],
"keyword": "Then "
}
],
"tags": [
{
"name": "@listsize"
}
]
}
],
"name": "Test List size",
"description": "",
"id": "test-list-size",
"keyword": "Feature",
"uri": "src/test/features/CheckListSize2.feature",
"tags": []
}
]
Я хочу, чтобы все эти elements.id находились в элементах [*]. Steps [*]. Result - «fail»
Iпопытался выполнить запрос ниже, но он не дал никакого результата.
$..elements[?(@.steps[*].result=="failed")].id
Текущее поведение : список Json пуст []
Ожидаемое поведение : Запрос должен возвращать все element.id, где статус результата был «сбой».
например: id = 'test-list-size; list-size-test'
Couldкто-нибудь, пожалуйста, помогите?