Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Platform Validation
Commits
7774d6e5
Commit
7774d6e5
authored
Oct 08, 2020
by
Kamlesh Todai
Browse files
Change column name Pass to Executed and correct the percentage computation of pass rate
parent
027ba979
Pipeline
#11442
failed with stages
in 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Summarize_Newman_Html_Reports.py
View file @
7774d6e5
...
...
@@ -97,7 +97,7 @@ def processFile(fnm, platform, rowNo, colOffset, envFileNamesPopulated):
skippedTests
=
info
count
+=
1
# Compute the pass rate (percentage of test that passed for the collection)
passRate
=
(
100
*
float
(
totalAssertionPassed
)
/
(
float
(
totalAssertion
Passed
)
+
float
(
totalAssertion
Fail
ed
))
)
passRate
=
(
100
*
(
(
float
(
totalAssertionPassed
)
-
float
(
totalAssertion
Failed
))
/
float
(
totalAssertion
Pass
ed
)
)
)
# print("totalRequestsPassed: " + totalRequestsPassed)
# print("totalRequestsFailed: " + totalRequestsFailed)
...
...
@@ -147,9 +147,16 @@ records = []
env_file_names
=
[]
env_file_names_populated
=
False
collection_run_date
=
[]
#
fillColList
=
[
5
,
9
,
13
]
# column list that are acting as separator between platforms
pctColList
=
[
4
,
8
,
12
,
16
]
# column list that hold passRate (percent) values
passColList
=
[
2
,
6
,
10
,
14
]
# column list that hold number of request pass values
failColList
=
[
3
,
7
,
11
,
15
]
# column list that hold number of request fail values
#
# Define the headers for the excel file
records
.
append
((
""
,
""
,
""
,
"AWS"
,
""
,
""
,
""
,
"AZURE"
,
""
,
""
,
""
,
"GCP"
,
""
,
""
,
""
,
"IBM"
,
""
))
records
.
append
((
"Collection Name"
,
"#of Requests"
,
"Pass"
,
"Fail"
,
"PassRate"
,
""
,
"Pass"
,
"Fail"
,
"PassRate"
,
""
,
"Pass"
,
"Fail"
,
"PassRate"
,
""
,
"Pass"
,
"Fail"
,
"PassRate"
))
# Note: Pass column name was changed to Executed. The variable names were not changed only column name was changed.
records
.
append
((
"Collection Name"
,
"#of Requests"
,
"Executed"
,
"Fail"
,
"PassRate"
,
""
,
"Executed"
,
"Fail"
,
"PassRate"
,
""
,
"Executed"
,
"Fail"
,
"PassRate"
,
""
,
"Executed"
,
"Fail"
,
"PassRate"
))
#Create and initialize the excel file
workbook
=
xlsxwriter
.
Workbook
(
'NewmanHtmlReportsSummary.xlsx'
)
...
...
@@ -157,6 +164,10 @@ worksheet = workbook.add_worksheet()
# set the column width
worksheet
.
set_column
(
0
,
0
,
40
)
# Column for Collection Name
worksheet
.
set_column
(
1
,
1
,
12
)
# Column for number of request
for
iCol
in
passColList
:
worksheet
.
set_column
(
iCol
,
iCol
,
10
)
# column width for executed
# set variaous formats that will be used to wirte the data to the Excel file
cell_format
=
workbook
.
add_format
({
'align'
:
'center'
,
'bold'
:
True
})
#
...
...
@@ -198,11 +209,6 @@ head2_green_cell_format.set_font_size(12)
head2_red_cell_format
=
workbook
.
add_format
({
'align'
:
'center'
,
'bold'
:
True
,
'bg_color'
:
'#BBD7EF'
,
'font_color'
:
'red'
})
head2_red_cell_format
.
set_font_size
(
12
)
#
fillColList
=
[
5
,
9
,
13
]
# column list that are acting as separator between platforms
pctColList
=
[
4
,
8
,
12
,
16
]
# column list that hold passRate (percent) values
passColList
=
[
2
,
6
,
10
,
14
]
# column list that hold number of request pass values
failColList
=
[
3
,
7
,
11
,
15
]
# column list that hold number of request fail values
#
#Write the header records to excel file
rowNum
=
0
col_offset
=
0
...
...
@@ -225,7 +231,7 @@ for row_num in records:
curPlatform
=
""
localRowNo
=
rowNum
collName
=
[]
for
file
in
sorted
(
os
.
listdir
(
"."
)
)
:
for
file
in
os
.
listdir
(
"."
):
if
(
file
.
endswith
(
".html"
)):
# process only html files
fileParts
=
file
.
split
(
"."
)
if
(
fileParts
[
0
]
==
"index"
):
...
...
@@ -282,11 +288,14 @@ sumStartIdxStr = str(sumStartIdx)
sumEndIdxStr
=
str
(
sumEndIdx
)
# popluate the arrays to sum the pass, fail and passRate values for each platform as well as total number of requests
# e.g. [ ['B14', '{=SUM(B3:B13)}'],...,[...]]
# passRate = (100 * ( (float(totalAssertionPassed) - float(totalAssertionFailed)) / float(totalAssertionPassed) ) )
# E14 = 100 * ( (C14-D14)/C14) )
# "E"+rowIndxStr, "{=(100.0 * ( (C"+rowIndxStr+"-D"+rowIndxStr+")/C"+rowIndxStr +") )}"
col_lables
=
[[
"B"
+
rowIndxStr
,
"{=SUM(B"
+
sumStartIdxStr
+
":B"
+
sumEndIdxStr
+
")}"
],
[
"C"
+
rowIndxStr
,
"{=SUM(C"
+
sumStartIdxStr
+
":C"
+
sumEndIdxStr
+
")}"
],
[
"D"
+
rowIndxStr
,
"{=SUM(D"
+
sumStartIdxStr
+
":D"
+
sumEndIdxStr
+
")}"
],
[
"E"
+
rowIndxStr
,
"{=
SUM(E"
+
sumStartIdxStr
+
":E"
+
sumEndI
dxStr
+
")}"
],
[
"G"
+
rowIndxStr
,
"{=SUM(G"
+
sumStartIdxStr
+
":G"
+
sumEndIdxStr
+
")}"
],
[
"H"
+
rowIndxStr
,
"{=SUM(H"
+
sumStartIdxStr
+
":H"
+
sumEndIdxStr
+
")}"
],
[
"I"
+
rowIndxStr
,
"{=
SUM(I"
+
sumStartIdxStr
+
":I"
+
sumEndI
dxStr
+
")}"
],
[
"K"
+
rowIndxStr
,
"{=SUM(K"
+
sumStartIdxStr
+
":K"
+
sumEndIdxStr
+
")}"
],
[
"L"
+
rowIndxStr
,
"{=SUM(L"
+
sumStartIdxStr
+
":L"
+
sumEndIdxStr
+
")}"
],
[
"M"
+
rowIndxStr
,
"{=
SUM(M"
+
sumStartIdxStr
+
":M"
+
sumEndI
dxStr
+
")}"
],
[
"O"
+
rowIndxStr
,
"{=SUM(O"
+
sumStartIdxStr
+
":O"
+
sumEndIdxStr
+
")}"
],
[
"P"
+
rowIndxStr
,
"{=SUM(P"
+
sumStartIdxStr
+
":P"
+
sumEndIdxStr
+
")}"
],
[
"Q"
+
rowIndxStr
,
"{=
SUM(Q"
+
sumStartIdxStr
+
":Q"
+
sumEndI
dxStr
+
")}"
]]
[
"D"
+
rowIndxStr
,
"{=SUM(D"
+
sumStartIdxStr
+
":D"
+
sumEndIdxStr
+
")}"
],
[
"E"
+
rowIndxStr
,
"{=
(100.0 * ( (C"
+
rowIndxStr
+
"-D"
+
rowIndxStr
+
")/C"
+
rowIn
dxStr
+
")
)
}"
],
[
"G"
+
rowIndxStr
,
"{=SUM(G"
+
sumStartIdxStr
+
":G"
+
sumEndIdxStr
+
")}"
],
[
"H"
+
rowIndxStr
,
"{=SUM(H"
+
sumStartIdxStr
+
":H"
+
sumEndIdxStr
+
")}"
],
[
"I"
+
rowIndxStr
,
"{=
(100.0 * ( (G"
+
rowIndxStr
+
"-H"
+
rowIndxStr
+
")/G"
+
rowIn
dxStr
+
")
)
}"
],
[
"K"
+
rowIndxStr
,
"{=SUM(K"
+
sumStartIdxStr
+
":K"
+
sumEndIdxStr
+
")}"
],
[
"L"
+
rowIndxStr
,
"{=SUM(L"
+
sumStartIdxStr
+
":L"
+
sumEndIdxStr
+
")}"
],
[
"M"
+
rowIndxStr
,
"{=
(100.0 * ( (K"
+
rowIndxStr
+
"-L"
+
rowIndxStr
+
")/K"
+
rowIn
dxStr
+
")
)
}"
],
[
"O"
+
rowIndxStr
,
"{=SUM(O"
+
sumStartIdxStr
+
":O"
+
sumEndIdxStr
+
")}"
],
[
"P"
+
rowIndxStr
,
"{=SUM(P"
+
sumStartIdxStr
+
":P"
+
sumEndIdxStr
+
")}"
],
[
"Q"
+
rowIndxStr
,
"{=
(100.0 * ( (O"
+
rowIndxStr
+
"-P"
+
rowIndxStr
+
")/O"
+
rowIn
dxStr
+
")
)
}"
]]
col_label_indx
=
0
# Populate/write the Total Row
for
j
in
range
(
total_cols
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment