diff --git a/docs/examples/report-result.md b/docs/examples/report-result.md index 92cc32d..a13542b 100644 --- a/docs/examples/report-result.md +++ b/docs/examples/report-result.md @@ -54,7 +54,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/basic/via auth/Basic Auth 401 - 2/2 - ⌛0.2 s @@ -79,7 +78,6 @@ Pass | :white_check_mark: | assert | res.body Unauthorized | | - ### 🟢 auth/basic/via script/Basic Auth 200 - 2/2 - ⌛0.239 s @@ -104,7 +102,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/basic/via script/Basic Auth 401 - 2/2 - ⌛0.21 s @@ -129,7 +126,6 @@ Pass | :white_check_mark: | assert | res.body Unauthorized | | - ### 🟢 auth/bearer/via auth/Bearer Auth 200 - 2/2 - ⌛0.476 s @@ -154,7 +150,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/bearer/via auth/Bearer Auth 401 - 2/2 - ⌛0.494 s @@ -179,7 +174,6 @@ Pass | :white_check_mark: | assert | res.body.message Unauthorized | | - ### 🟢 auth/bearer/via headers/Bearer Auth 200 - 2/2 - ⌛0.549 s @@ -204,7 +198,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/bearer/via headers/Bearer Auth 401 - 2/2 - ⌛0.502 s @@ -229,7 +222,6 @@ Pass | :white_check_mark: | assert | res.body.message Unauthorized | | - ### 🟢 auth/cookie/Login - 0/0 - ⌛0.193 s @@ -409,7 +401,6 @@ Pass | Status | Type | Expression | Error | | :----: | ---- | ---------- | ----- | - | :white_check_mark: | test | should return parsed xml | | @@ -524,7 +515,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/basic/via auth/Basic Auth 401 - 2/2 - ⌛0.202 s @@ -549,7 +539,6 @@ Pass | :white_check_mark: | assert | res.body Unauthorized | | - ### 🟢 auth/basic/via script/Basic Auth 200 - 2/2 - ⌛0.204 s @@ -574,7 +563,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/basic/via script/Basic Auth 401 - 2/2 - ⌛0.205 s @@ -599,7 +587,6 @@ Pass | :white_check_mark: | assert | res.body Unauthorized | | - ### 🟢 auth/bearer/via auth/Bearer Auth 200 - 2/2 - ⌛0.486 s @@ -624,7 +611,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/bearer/via auth/Bearer Auth 401 - 2/2 - ⌛0.212 s @@ -649,7 +635,6 @@ Pass | :white_check_mark: | assert | res.body.message Unauthorized | | - ### 🟢 auth/bearer/via headers/Bearer Auth 200 - 2/2 - ⌛0.192 s @@ -674,7 +659,6 @@ Pass | :white_check_mark: | assert | res.body.message Authentication successful | | - ### 🟢 auth/bearer/via headers/Bearer Auth 401 - 2/2 - ⌛0.224 s @@ -699,7 +683,6 @@ Pass | :white_check_mark: | assert | res.body.message Unauthorized | | - ### 🟢 auth/cookie/Login - 0/0 - ⌛0.198 s @@ -879,7 +862,6 @@ Pass | Status | Type | Expression | Error | | :----: | ---- | ---------- | ----- | - | :white_check_mark: | test | should return parsed xml | | diff --git a/src/bru-md-utils.jq b/src/bru-md-utils.jq index f44076b..1fe507d 100644 --- a/src/bru-md-utils.jq +++ b/src/bru-md-utils.jq @@ -103,16 +103,33 @@ def md_assert_table_assert_row: "| \(get_status_icon(.status)) | assert | \(.lhsExpr) \(.rhsExpr // "--") | \(.error // "") |" ; + +def md_assert_table_assert_rows: + if (.assertionResults | length > 0) then + "\([ .assertionResults[] | md_assert_table_assert_row ] | join("\n"))\n" + else + "" + end +; + def md_assert_table_test_row: "| \(get_status_icon(.status)) | test | \(.description // "--") | \(.error // "") |" ; +def md_assert_table_test_rows: + if (.testResults | length > 0) then + ([ .testResults[] | md_assert_table_test_row ] | join("\n")) + "\n" + else + "" + end +; + def md_assert_table: if (. | count_verify_steps > 0) then "| Status | Type | Expression | Error |\n" + "| :----: | ---- | ---------- | ----- |\n" + - ([ .assertionResults[] | md_assert_table_assert_row ] | join("\n")) + "\n" + - ([ .testResults[] | md_assert_table_test_row ] | join("\n")) + "\n" + "\( . | md_assert_table_assert_rows )" + + "\( . | md_assert_table_test_rows )" else "> **None**\n" end