Vinay
Vinay

Reputation:

Can I code actions directly using vbscript when QTP does the same thing too?

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?

Upvotes: 2

Views: 1763

Answers (3)

Trimble Epic
Trimble Epic

Reputation: 466

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.

Upvotes: -1

Helen
Helen

Reputation: 98022

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.

Upvotes: 2

tsilb
tsilb

Reputation: 8035

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.

Upvotes: 1

Related Questions