Commit 7774d6e5 authored by Kamlesh Todai's avatar 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
......@@ -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(totalAssertionPassed) + float(totalAssertionFailed)) )
passRate = (100 * ( (float(totalAssertionPassed) - float(totalAssertionFailed)) / float(totalAssertionPassed) ) )
# 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"+sumEndIdxStr+")}"],
["G"+rowIndxStr, "{=SUM(G"+sumStartIdxStr+":G"+sumEndIdxStr+")}"], ["H"+rowIndxStr, "{=SUM(H"+sumStartIdxStr+":H"+sumEndIdxStr+")}"], ["I"+rowIndxStr, "{=SUM(I"+sumStartIdxStr+":I"+sumEndIdxStr+")}"],
["K"+rowIndxStr, "{=SUM(K"+sumStartIdxStr+":K"+sumEndIdxStr+")}"], ["L"+rowIndxStr, "{=SUM(L"+sumStartIdxStr+":L"+sumEndIdxStr+")}"], ["M"+rowIndxStr, "{=SUM(M"+sumStartIdxStr+":M"+sumEndIdxStr+")}"],
["O"+rowIndxStr, "{=SUM(O"+sumStartIdxStr+":O"+sumEndIdxStr+")}"], ["P"+rowIndxStr, "{=SUM(P"+sumStartIdxStr+":P"+sumEndIdxStr+")}"], ["Q"+rowIndxStr, "{=SUM(Q"+sumStartIdxStr+":Q"+sumEndIdxStr+")}"]]
["D"+rowIndxStr, "{=SUM(D"+sumStartIdxStr+":D"+sumEndIdxStr+")}"], ["E"+rowIndxStr, "{=(100.0 * ( (C"+rowIndxStr+"-D"+rowIndxStr+")/C"+rowIndxStr +") )}"],
["G"+rowIndxStr, "{=SUM(G"+sumStartIdxStr+":G"+sumEndIdxStr+")}"], ["H"+rowIndxStr, "{=SUM(H"+sumStartIdxStr+":H"+sumEndIdxStr+")}"], ["I"+rowIndxStr, "{=(100.0 * ( (G"+rowIndxStr+"-H"+rowIndxStr+")/G"+rowIndxStr +") )}"],
["K"+rowIndxStr, "{=SUM(K"+sumStartIdxStr+":K"+sumEndIdxStr+")}"], ["L"+rowIndxStr, "{=SUM(L"+sumStartIdxStr+":L"+sumEndIdxStr+")}"], ["M"+rowIndxStr, "{=(100.0 * ( (K"+rowIndxStr+"-L"+rowIndxStr+")/K"+rowIndxStr +") )}"],
["O"+rowIndxStr, "{=SUM(O"+sumStartIdxStr+":O"+sumEndIdxStr+")}"], ["P"+rowIndxStr, "{=SUM(P"+sumStartIdxStr+":P"+sumEndIdxStr+")}"], ["Q"+rowIndxStr, "{=(100.0 * ( (O"+rowIndxStr+"-P"+rowIndxStr+")/O"+rowIndxStr +") )}"]]
col_label_indx = 0
# Populate/write the Total Row
for j in range(total_cols):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment