开发者

QTP Keyword driven basic example

I have been looking for very basic keyword driven test..i do not understan开发者_Python百科d well how you can separate the test specifically from application so its reusable. In my understanding, the QTP commands like "navigate" are keywords. But how to create my own independent ones? I would be very grateful for example of how to do that. I found either too complex or just theoretical ones. Thank you very much


In QTP jargon a keyword is a combination of a test object and method (see the available keywords pane).

Keyword driven testing is used to mean creating a test without recording. You can create test objects in one of the following methods and then construct a test from these test objects.

  1. Descriptive programming
  2. Manually create test objects in the object repository (using the create new command)
  3. Using navigate and learn
  4. Record and discard the script
  5. Import from XML


Example of a test. Go to a web store. Search for a product. Login. Buy. Logout. (The test is already broken down to keywords)

The simplest approach. Simply write a list of operations for the corresponding objects. E.g. a simplified variant:

Browser.Open(WebStoreURL)
Browser.Sync
Browser.Page.WebEdit(SearchBoxName).Type "something I want"
' then login, buy, logout using the same approach
' add verification points where needed

In the end you have quite a long script. If you need to write another script that tests a similar case, you need to repeat most of the actions above.

Another approach. To avoid duplication, you can, for example, create such functions/actions: Login, Logout, Search(product_name), etc. And then create scripts using these actions/functions, i.e. keywords:

Login
Search "something I want"
Buy
Logout

It is an example of a keyword driven approach. It works on a higher level of abstraction then QTP commands.

The approach is not limited to using QTP functions. Keywords can be implemented as words in an Excel file.


I don't know about overloading of keywords. But when i was writing test cases in QTP for automation. I used configurable navigation paths in the prop or config file n all i needed to do was call a generic function which took source n destination n using those prop files navigate to the proper location.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜