Cadet 3rd Class
Cadet 3rd Class

How to Convert API Test Flow Diagram in vbscript so that we can use it in our automation framework?


From API test I am able to create flow diagram for Web Service testing. But now I want to use API test in my GUI testing framework. So that I can parameterize value, can log reoprt in my logger and can execute test case through my framework. How can i create VB script for web service testing?

3 Replies
Absent Member.
Absent Member.

If you mean by using COM objects in GUI test (VbScript).

You may try the following line of codes below:

Set obj_WinHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
Set obj_XMLRequest = CreateObject("Msxml2.DOMDocument.3.0")

obj_XMLRequest.async = False
obj_XMLRequest.loadXML str_RequestString
obj_WinHttp.SetTimeouts 300000, 300000, 300000, 300000
'Prepare soap request.
obj_WinHttp.Open "POST", "[endpoint here]"
obj_WinHttp.SetRequestHeader "SOAPAction", "[endpoint here]"
obj_WinHttp.SetRequestHeader "Content-Type", "text/xml; charset=utf-8"
obj_WinHttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = 13056
' WinHTTPRequest options:
Const WinHttpRequestOption_UserAgentString = 0
Const WinHttpRequestOption_URL = 1
Const WinHttpRequestOption_URLCodePage = 2
Const WinHttpRequestOption_EscapePercentInURL = 3
Const WinHttpRequestOption_SslErrorIgnoreFlags = 4
Const WinHttpRequestOption_SelectCertificate = 5
Const WinHttpRequestOption_EnableRedirects = 6
Const WinHttpRequestOption_UrlEscapeDisable = 7
Const WinHttpRequestOption_UrlEscapeDisableQuery = 8
Const WinHttpRequestOption_SecureProtocols = 9
Const WinHttpRequestOption_EnableTracing = 10
obj_WinHttp.Send obj_XMLRequest

str_Response = obj_WinHttp.ResponseText



Cadet 3rd Class
Cadet 3rd Class

Thanks for your response. But how I can give request value and response value. I have to parameterize it through excel.

And for different kind of WSDL will be having different response.

Absent Member.
Absent Member.

You can do ahead with API test parametrization without writing separate wrapper GUI test around it.

These are the steps in brief: Import Excel-Parametrize WSDL-Parametrize inputs-Parametrize outputs

To import your excel, ideally, place it in ALM resources so that it is at a common location or make sure its is in C:\Temp and not on desktop where user may change. Once the excel is placed, open the API test, in the bottom pane, select Data Tab, click on new data source and select Excel. Give a data source name and browse the excel file path, check/uncheck other options as needed. Once complete, you should be able to view the enter excel in the data source pane.

To parametrize the WSDL path, in the Test Flow, select the API test method, open properties and select the option General in the right properties pane. In that expand, Transport-Choice-HTTP-Endpoint Address. That location will have the WSDL your test is pointing to. At the corner, you will find the Chain icon to Link to data source, click on it. Select data source column and map it to the excel accordingly.

To parametrize input/checkpoints, follow the same process by linking data sources. You can link this API test in a GUI test and make it return values or also write to the excel from the output of the API test based on your need. Hopefully this helps.


The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.