Question

Basic doubt...If QTP generates vbscript code as we record actions, can't we directly write vbscript code and get rid of QTP which does the same thing too?

Was it helpful?

Solution

Yes. You can write the code yourself, but you'd have to paste it into the QTP UI.

No. QTP is the engine that runs through it. The VBScript relies on the QTP UI to perform the actions in question, such as clicking on a link on a web page.

OTHER TIPS

While you can write QTP test scripts in any text editor (whether QTP IDE, Notepad or any other editor of your choice), you can run them only from QTP as it extends VBScript with its own object model providing the test objects (e.g. Browser) and test actions (e.g. Click). Outside of QTP these objects and actions are not defined, so you can't run test scripts directly via Windows Script Host.

I think the question you're trying to ask is: Can I write automated test scripts using just VBScript without using QTP itself at all?

QTP itself provides specific facilities/features for automating tests. VBScript is simply the script language chosen to let you tie those features together in the order you choose.

For example, QTP provides the object recognition system... which gives you the ability to click on a specific button in a specific window by simply calling the method: Window("MyApp").Button("OK").Click Without QTP, that facility doesn't exist.

Other useful features provided by QTP are DataTables, Timers, Reporter, and the whole Actions system. Without QTP, VBScript just doesn't have those available.

So, my answer to your questions is - Yeah, you could, but then you'd have to find another way to do all that stuff.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top