Simple Excel to Test your Web API Testing Automation and Regression
Excel macro we use the HTTP function to make call and also log the responses to the Excel.
Excel can we used for Analytic and also for the Analyzing the Statistics.
Macro Test
Sub Test()
Dim strXML, strResponse, count
Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")
count = Application.WorksheetFunction.count(Range("A:A")) + 3
'MsgBox (count)
For i = 4 To count
If Cells(i, 4) = "" Then
myurl = Cells(1, 2) + Cells(i, 3)
Else
myurl = Cells(1, 2) + Cells(i, 3) + "?" + Cells(i, 4)
End If
'MsgBox (myurl)
XMLHTTP.Open Cells(i, 2), myurl, False
XMLHTTP.setRequestHeader "signatureSecret", Cells(1, 4)
XMLHTTP.send
Cells(i, 8) = XMLHTTP.getAllResponseHeaders()
Cells(i, 9) = XMLHTTP.getResponseHeader("signatureSecret")
Cells(i, 6) = (XMLHTTP.responseText)
Cells(i, 7) = (XMLHTTP.Status)
Next i
End Sub
You use Excel function to Compare the Expected Result
Excel can we used for Analytic and also for the Analyzing the Statistics.
Macro Test
Sub Test()
Dim strXML, strResponse, count
Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")
count = Application.WorksheetFunction.count(Range("A:A")) + 3
'MsgBox (count)
For i = 4 To count
If Cells(i, 4) = "" Then
myurl = Cells(1, 2) + Cells(i, 3)
Else
myurl = Cells(1, 2) + Cells(i, 3) + "?" + Cells(i, 4)
End If
'MsgBox (myurl)
XMLHTTP.Open Cells(i, 2), myurl, False
XMLHTTP.setRequestHeader "signatureSecret", Cells(1, 4)
XMLHTTP.send
Cells(i, 8) = XMLHTTP.getAllResponseHeaders()
Cells(i, 9) = XMLHTTP.getResponseHeader("signatureSecret")
Cells(i, 6) = (XMLHTTP.responseText)
Cells(i, 7) = (XMLHTTP.Status)
Next i
End Sub
You use Excel function to Compare the Expected Result
Comments
Post a Comment