fumeng
fumeng

Reputation: 1830

Trigger QTP script from HTML page

Is it possible to have a submit button on an HTML page run a QTP script and output results in a nice, readable format?

Thanks for any tips!

Upvotes: 1

Views: 1168

Answers (1)

AutomatedChaos
AutomatedChaos

Reputation: 7490

QTP has possibilities to run as a COM object (also known as ActiveX component). You can create such a script in the VBScript language from QTP itself, but as it is a COM object, you can also use Javascript, C# or other languages to start QTP and run a script. To make it work from a HTML you have several possibilities:

If you open the HTML page from a location on the local machine or from the intranet (as this is seen as a 'trusted' location), you could do that with the ActiveX/COM interface of QTP, it is not seen as hostile. The easiest way to do it.

If rights are not correctly set on your desktop (local machine and/or intranet are seen the same as not trusted internet), you can do that with an HTA (HTML Application). Just the same as an HTML, but VBScript and ActiveX is allowed. This is my favorite because it is stand alone and you can connect to the filesystem, databases etc.

You can also serve the HTML page from a server. The server must be on the same domain as QTP and you have to make a start script in the webserver language (ASP/ASP.NET, php, java etc.). If you expose the site to the internet, you can also start scripts from home. (and if you don't password protect it, everybody can...).

Reporting can also been done. You can extract the QTP reporting to XML and from there it would be quite simple to create an HTML and display it in your browser. I think you can even find code and applications on the internet from people done the same.

If your QTP framework is a bit more sophisticated, you can create a line of HTML with each test action and append it to a report_html file. Or even better: create a JSON line for each test action and append it to a file. The JSON file can be read by humans, through your HTML page where you can create a parser, or by machines if you want to store results in a database, import it into Quality Center or to make a summary in Excel.

Upvotes: 3

Related Questions