Skip to content

Commit

Permalink
updating code
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Nov 22, 2024
1 parent 4637703 commit 2c20b63
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 60 deletions.
21 changes: 10 additions & 11 deletions src/junit.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,28 +250,27 @@ function parseTestSuites(options, testSuites, totalSuitTime, avgSuitTime){

let uuid = crypto.randomUUID();
let state = "passed";
if(testcase.failure || testcase.error){
if((testcase.status && testcase.status.toLowerCase() === 'failed') || testcase.failure || testcase.error)
{
err = getError(testcase);
state = "failed";
failedTests++;
}
if(testcase.skipped){
if((testcase.status && testcase.status.toLowerCase() === 'skipped') || testcase.skipped){
state = options.skippedAsPending ? "pending" : "skipped";
skippedTests++;
}

let speed = "fast";
let duration = testcase.time ? Math.ceil(testcase.time * 1000) : 0;

if(!testcase.skipped){
if(totalSuitTime && totalSuitTime !==0 && testcase.time){
if(duration >= avgSuitTime){
speed = "slow";
}else if(duration >= mediumTime){
speed = "medium";
}else{
speed = "fast";
}
if(totalSuitTime && totalSuitTime !==0 && testcase.time){
if(duration >= avgSuitTime){
speed = "slow";
}else if(duration >= mediumTime){
speed = "medium";
}else{
speed = "fast";
}
}

Expand Down
98 changes: 49 additions & 49 deletions tests/data/result/trx-sample-mochawesome.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"results": [
{
"uuid": "a6a4f527-9968-49aa-846e-a2c0beddca33",
"uuid": "0a958636-2adc-408f-95f1-8ca319f52105",
"title": "",
"fullFile": "",
"file": "",
Expand All @@ -25,7 +25,7 @@
"tests": [],
"suites": [
{
"uuid": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"title": "AccountTest2.AccountTest",
"file": "",
"beforeHooks": [],
Expand All @@ -43,8 +43,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "b2265a2c-fdb7-4d84-bd5f-803e3f6ee310",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "892fa0cf-031c-4c8d-9a7e-a6bff2fb8771",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -60,8 +60,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "bfbeb7d2-e763-4ccd-ab98-1c062052a510",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "0a8e256d-4652-4c11-805a-8c4fe4dd6a87",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -77,8 +77,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "d18aefee-049c-43b9-928e-d03540a6d404",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "b6bd6ed6-7a6a-40f6-af7d-482d67726317",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -94,8 +94,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "2bac477a-ac0c-46b3-ba19-a0a5d38a8034",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "a001b4a4-8963-4b29-8c2b-32101075f76a",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -111,8 +111,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "5be5af08-a462-488e-b13d-652dd9906ba5",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "983f9578-6f79-4876-8e63-e4bccc433064",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -128,8 +128,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "23e6efd8-883e-428b-96d5-ec1d66019ac9",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "da0d45a1-2050-4ae5-80ec-1e912f4e3665",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -145,8 +145,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "8fc3928c-1b12-4642-972c-dc6a5a8e36d2",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "b23d4237-363d-45ec-a1ad-d273a181f5f1",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -166,8 +166,8 @@
"estack": "at AccountTest2.AccountTest.MTestFail() in c:\\Jenkins_Home\\jobs\\NUnit_Quick_Learning\\workspace\\AccountTest2\\AccountMTest.cs:line 253",
"diff": null
},
"uuid": "1d0a141f-d88f-4050-9a33-531f08f56f84",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "5a1ad9e9-b05d-4147-8258-80b59427caca",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -183,8 +183,8 @@
"context": "[\"skipped: Assert.Inconclusive failed. Inconclusive result\"]",
"code": null,
"err": {},
"uuid": "44eef5ae-948d-4981-bb21-03c981bc4ec9",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "6f716677-a00b-47f2-975e-d5e09104dceb",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -200,8 +200,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "58fee468-e5d6-41fd-ad3e-b01ee9b5b154",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "79925fc4-8db2-43bf-829f-f12b14930250",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -217,8 +217,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "c980d3c5-d5a3-4ac0-89f0-9872cb1ead1d",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "5da2ba5f-f042-45e5-972e-f495a7ba7b61",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -234,8 +234,8 @@
"context": null,
"code": null,
"err": {},
"uuid": "5da3a46b-86bd-488d-955d-933d74e25240",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "a09b9a8a-4d24-4ddc-ac96-d2094224c14d",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
},
Expand All @@ -251,31 +251,31 @@
"context": null,
"code": null,
"err": {},
"uuid": "0d6f20ac-6ed0-4d70-82b7-8d3becf6bed6",
"parentUUID": "e0f10d7c-1049-48bc-8ab6-a6cb67cd4779",
"uuid": "c0a52d1d-5e0f-40fe-97b2-c016c296c390",
"parentUUID": "0ee8fb93-8572-40b9-9240-220985ed4a6b",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [
"b2265a2c-fdb7-4d84-bd5f-803e3f6ee310",
"bfbeb7d2-e763-4ccd-ab98-1c062052a510",
"d18aefee-049c-43b9-928e-d03540a6d404",
"2bac477a-ac0c-46b3-ba19-a0a5d38a8034",
"5be5af08-a462-488e-b13d-652dd9906ba5",
"23e6efd8-883e-428b-96d5-ec1d66019ac9",
"8fc3928c-1b12-4642-972c-dc6a5a8e36d2",
"c980d3c5-d5a3-4ac0-89f0-9872cb1ead1d",
"5da3a46b-86bd-488d-955d-933d74e25240",
"0d6f20ac-6ed0-4d70-82b7-8d3becf6bed6"
"892fa0cf-031c-4c8d-9a7e-a6bff2fb8771",
"0a8e256d-4652-4c11-805a-8c4fe4dd6a87",
"b6bd6ed6-7a6a-40f6-af7d-482d67726317",
"a001b4a4-8963-4b29-8c2b-32101075f76a",
"983f9578-6f79-4876-8e63-e4bccc433064",
"da0d45a1-2050-4ae5-80ec-1e912f4e3665",
"b23d4237-363d-45ec-a1ad-d273a181f5f1",
"5da2ba5f-f042-45e5-972e-f495a7ba7b61",
"a09b9a8a-4d24-4ddc-ac96-d2094224c14d",
"c0a52d1d-5e0f-40fe-97b2-c016c296c390"
],
"failures": [
"1d0a141f-d88f-4050-9a33-531f08f56f84"
"5a1ad9e9-b05d-4147-8258-80b59427caca"
],
"pending": [
"44eef5ae-948d-4981-bb21-03c981bc4ec9",
"58fee468-e5d6-41fd-ad3e-b01ee9b5b154"
"6f716677-a00b-47f2-975e-d5e09104dceb",
"79925fc4-8db2-43bf-829f-f12b14930250"
],
"skipped": [],
"duration": 144,
Expand All @@ -284,7 +284,7 @@
"_timeout": 10000
},
{
"uuid": "f92cc173-542f-4ba3-b1ca-f6e87b38c771",
"uuid": "2e4a1b7b-fc15-4b55-a368-9607cd89fdbf",
"title": "AccountTest2.InsufficientFundsExceptionTest",
"file": "",
"beforeHooks": [],
Expand All @@ -302,15 +302,15 @@
"context": null,
"code": null,
"err": {},
"uuid": "7b3cbd3e-cc85-443a-a462-c79e7ad04e1d",
"parentUUID": "f92cc173-542f-4ba3-b1ca-f6e87b38c771",
"uuid": "3475c4d0-dfba-4099-959e-892c23626ee9",
"parentUUID": "2e4a1b7b-fc15-4b55-a368-9607cd89fdbf",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [
"7b3cbd3e-cc85-443a-a462-c79e7ad04e1d"
"3475c4d0-dfba-4099-959e-892c23626ee9"
],
"failures": [],
"pending": [],
Expand All @@ -321,7 +321,7 @@
"_timeout": 10000
},
{
"uuid": "d855004e-0a87-4d72-9a15-8cb53b6de97e",
"uuid": "9b010a23-2392-4496-a6b9-3f47d4e45b5b",
"title": "AccountTest2.OverdrawnExceptionTest",
"file": "",
"beforeHooks": [],
Expand All @@ -339,15 +339,15 @@
"context": null,
"code": null,
"err": {},
"uuid": "1739c66c-5638-4f35-b581-f4a34c844cd2",
"parentUUID": "d855004e-0a87-4d72-9a15-8cb53b6de97e",
"uuid": "6514ee3d-e9b3-4d64-a0dc-c63818c2019d",
"parentUUID": "9b010a23-2392-4496-a6b9-3f47d4e45b5b",
"isHook": false,
"skipped": false
}
],
"suites": [],
"passes": [
"1739c66c-5638-4f35-b581-f4a34c844cd2"
"6514ee3d-e9b3-4d64-a0dc-c63818c2019d"
],
"failures": [],
"pending": [],
Expand Down

0 comments on commit 2c20b63

Please sign in to comment.