Can we pass data to QTP script through C# as parameters
Can someone please tell me if we can pass data from C# to QTP script. I have my C# web application on one server and QTP scripts on a different sever. I am trying to check whether we can pass data from my C# application as parameters QTP scripts so that the scripts will execute and return the results back to C# application. I know that QTP accepts data through Excel or notepad files. But i want to check if we can pass data to QTP as parameters(Like we pass data to a database procedure). I have been researching this since long can someone please let me know if you have been through such scenarios. Thanks in advance.
So as I understand, you are trying to control test execution on QTP via your C# web application, is that correct?
AFAIK, there is no way that QTP can do that way natively, however you can create method that allow C# and QTP to interact with each other via a temporary files. 1 file serves as input value for QTP, 1 file serves as result/output from QTP and used as input for your C# application. Just high level. I used to make WinRunner work with another Java test tool with that mechanism.
The Automation Object Model will allow you to directly interact with QTP so you can pass parameters into the test and get data from the test while running (though limited).
Let me understand your query.
1. You have a C# web app, which output some values and these are inputs to your QTP Scripts.
2. Now your QTP scripts take these inputs and perform some operations and generates some output file/s.
3. The output files from QTP are now input to your C# web application.
If this is your requirement, you can do this.
For step 1: From your web app, writes the values into a txt,excel or xml file(say tempInput). As you have different servers you can use FTP to transfer files or can create a shared Drive between these two servers.
(Note: Before writing values into the file, delete already existing tempInput file and then write values into the file which enforces the updated data).
For step 2: Now in step 2, read values from tempInput file and use in QTP scripts and write output values in a file calles say tempOutput.
For step 3: Read values from tempOutput file in your web application.
If you want the whole thing interactively you may need bit more coding using AOM etc.
Let me know if you didnt understand anything from the above.
For design consideration , use common database and Object model.
First of all thanks for your detailed explanation.
I have a question, Once i write the data in the tempInput excel file in a shared drive. Can you tell me how to pass the Excel file to QTP as an input from the shared drive. Also, my requirement is to get the pass or fail results from output file for each test case to .net gridview so that it will show all the results. The problem here is there might be more than one user that can run the QTP scripts by using our web application. Can you please suggest me any approach for this scenario?