Pages

Monday, June 13

Utility Statements in QTP - Part 3

Hello Friends,
This is in continuation from Part-1 and Part-2 of posts. Here we will cover following utility statements-
GetLastError Statement
InvokeApplication Statement
Print Statement
RegisterUserFunc Statement
RunAction Statement
SetLastError Statement
UnregisterUserFunc Statement
Wait Statement

GetLastError Statement

GetLastError returns the error code of the last/most recent error. It is used with the DescribeResult Statement.

Browser("mybrowser").Page("mypage").Image("myimage").Click 23, 47
errX = GetLastError
print (DescribeResult(errX))

In the above example, the script fails because the Login image was not found on the page. The error number is retrieved Using the GetLastError function and description of error using DescribeResult Statement.

SetLastError Statement

Inserts a VBScript error into the test script.

SetLastError(7)


InvokeApplication Statement

InvokeApplication is used to invoke an executable application i.e. '.exe' files.


InvokeApplication "C:\Program Files\Internet Explorer\IEXPLORE.EXE"


Print Statement

Print is very useful and simple to use statement, generally used in place of 'msgbox'. It displays information in the QuickTest Print Log window during the

run session. The log window remains open until you close it manually.


Print "This is an example"
Print Browser("MyBro").GetROProperty("title")

RegisterUserFunc Statement

Using RegisterUserFunc, you can add a new method or can override the existing method of any test object class.

For example, 'Set' is a method of WebEdit class, which sets value in the edit box.

Using RegisterUserFunc, you can change the behaviour of this method or you can add new method to WebEdit class.


Example

Function NewSet (obj, val)
 Dim MyWord
 MyWord = UCase(val)   ' Returns val in upper case
 MySet=obj.Set(val)
End Function


RegisterUserFunc "WebEdit", "Set", "NewSet"
Browser("MyBro").Page("MyPage").WebEdit("name").Set "abhikansh"
UnRegisterUserFunc "WebEdit", "Set"


In above code, you have just overridden 'Set' method with your new function 'NewSet'. Now default behavior of the Set is changed. Whatever you type now, it will be written in upper case in the edit box.

Enables you to add new methods to test objects or change the behavior of an existing test object method during a run session.

When you use this statement, QuickTest uses your user-defined function as a method of a specified test object class for the remainder of a run session, or until you unregister the method.

If the specified method name does not already exist for the test object, it becomes a new method for the object. If the method name is a defined QuickTest method for the object, your definition (temporarily) overrides the existing functionality of the specified method.


Please note that..

1. Registered method applies only to the test or library file in which you register it.
2. It is applicable to current run session only.
3. QuickTest clears all function registrations at the beginning of each run session.
4. UnRegisterUserFunc instructs QuickTests to stop using the current registration of the method.


RunAction statement

The RunAction statement runs the specified action (if associated with your test).
If you want to run external action, which is not associated with your test, then you have to use (Insert > Call to Action) or (Insert > Copy of Action) options from QTP menu.

RunAction "Action2", oneIteration


Easiest and more accurate way to use RunAction is through Menu.


Wait Statement

Wait is one of the most commonly used utility statement. Used for a pause of specified seconds, during a run session.

Wait(10)

Above statement will cause a pause of 10 seconds before moving to the next steps. Its a method of synchronization.

For other Synchronization methods, please refer >> http://www.qtpschool.com/2011/03/importance-of-qtp-synchronization.html

10 comments:

  1. Thank you very for share us such kind of good info

    ReplyDelete
  2. PG SLOT มีเกมหลากหลายให ้เลือก พรอ้ มกราฟฟิกแอนนเิมชนั่ สวยงามทสี่ ดุ ในยคุ นี้แจ็คพอตแตกง่าย pgslot โปรโมชนั่ พเิศษส าหรับทงั้สมาชก เกา่ และสมาชกิ ใหม่ ระบบฝาก-ถอนเงินออโต ้เงินเข ้าเร็วทันใจมีแอดมิ ดูแลตลอด 24 ชวั่ โมง ต ้องที่ pgslot.bid มั่นคงจ่ายจริง ไม่ว่าคุณจะถอนเงิ มากมายเท่าไหร่ ทางเว็บจ่ายเต็มไม่มีหัก pgslot ปั่นง่ายแตกง่าย

    pg slot ผู ้ให ้บริการเว็บตรง ที่แตกง่ายที่สุด ปั่นสนุก ฝากเงินรับเครดิตฟร สูงสุด 15000 บาท สมัคร พีจีสล็อต หรือ PGSLOT กับเราเพื่อความมั่นคงของคุณเอง.

    ReplyDelete
  3. 메이저놀이터리스트 안전메이저놀이터 메이저놀이터추천 pattern that give you money Part2

    ReplyDelete
  4. Secret mansion 스포츠중계 — like something out of James Bond

    ReplyDelete
  5. Prosecutor explains dice-sliding scheme at Cleveland 온라인포커 바둑이게임

    ReplyDelete
  6. 우리카지노는 대한민국의 바카라 업계를 장악하고 있는카지노사이트 입니다. 우리카지노가 대한 민국에서 장악한 바카라 시장점유율이 50%가 넘고 10년 넘게 온라인 바카라 시장을 장악해왔기 때문에 대한민국에서는 우리카지노를 모르는 사람은 드뭅니다. 이런 바카라 업계의 독보적인 입지 때문에 늘 유명하거나 최고만을 찾는 사람들이 카지노사이트를 찾을때는 늘
    우리카지노를 찾습니다.바카라를 처음 시작하시는 초보자분들에게도 우리카지노에서 카지노사이트를 시작하시기 좋은 환경입니다. 우리카지노사이트에서는 신규가입시 3만쿠폰을 지급 해주기 때문입니다. 사람들이 늘 1등만을 찾는 이유는 분명 있습니다. 다른 카지노사이트와는 달리 우리카지노를 이용하실시 에이전트를 끼고 게임을 하신다면 본사 이외에 활동쿠폰 및 오링쿠폰을 별도로 제공해주고 있기 때문입니다. 이러한 이유들 때문에 카지노사이트 업계에서 바카라를 즐기신다면 다들 우리카지노를 선호 하십니다. 카지노사이트에서 바카라를 이기기 물론 어렵습니다. 하지만 우리카지노의 에이전트를 끼고 바카라를 즐기신다면 승산이 있다고 봅니다. 우리카지노 에이전트의 연락처는 홈페이지로 연락하시면 언제든지 부담없이 소통가능 합니다. 카지노사이트를 선정할때는 바카라를 다른곳보다 유리하게 즐길 수 있는 카지노를 선택해야한다고 생각합니다. 그것이 바로 우리카지노 입니다. 이상으로 우리카지노와
    바카라 카지노사이트 사이의 상관관계를 알아보았습니다 바카라사이트.

    ReplyDelete
  7. Just 99 Web Design offers affordable web design packages for every business, from basic one-page websites to full eCommerce website design services. low cost website designing

    ReplyDelete
  8. Avantajlý ve kaliteli bir dünyaya Superbetin ile giriþ yapýn. süperbetin global ölçekte bahis ve casino hizmet veren bir þirkettir. Kullanýcýlar kaliteli bir hizmet sunmakta. Bahsedeceklerimizden ziyade sizlerde Superbetin giriþ yaparak hizmetleri görebilirsiniz. Makalemizde sizlere Superbetin güvenilir mi? Süperbetin giriþ bilgileri gibi konularda bahsedeceðiz. Ayrýca Superbetin kayýt ol sayesinde özel bonuslara ulaþýn. Sizlerde süperbetin sayesinde avantajlý bir bahis ve casino hizmeti ulaþýn.
    Süperbetin sunduðu hizmetler hakkýnda detaylý bilgiler vereceðiz. Lakin öncelikle sitenin güvenilirliðinden bahsedelim. Ýlk olarak güvenilir olmayan bir site sektörde uzun yýllar hizmet veremez. Dolandýrýcý siteler zaten en fazla 3 ay hizmet verebilmiþtir. Superbetin ise sektörde 10 yýlý aþkýn zamandýr hizmet vermekte. Lisansýný bahis ve casino sektörünün en göze lisans kurumu olan çuraçao hükümetinden almýþtýr. Superbetin oyunlarý bahis ve casino oyunlarýndan saðladýklarý kazançlarýný sorun yaþamadan çekebilmekte.
    Superbetin
    Süperbetin giriþ yaparak sizlerde avantajlý bir bahis ve casino hizmetine ulaþabilirsiniz. Türkiye’deki kullanýcýlar güncel giriþ adresine sayfamýzda her zaman ulaþabilmekte. Avantajlý bir bahis ve casino hizmetine doðru siteyi tercih ederek ulaþýn. Hesabý olmayan kullanýcýlar Süperbetin kayýt iþlemini kolay bir þekilde yapabilmekte. Hiçbir ek belge göndermeden ve ayrýca kimlik bilgisi vermeden kolay bir þekilde hesabýnýzý oluþturun. Ayrýca yeni üyelere özel bonuslar bulunmakta. Deneme bonusu ve hoþgeldin bonusu yeni üyelere özeldir.
    Süperbetin bahis bölümünde geniþ bir bahis bülteni canlý olarak iddaa oynayabilirsiniz. Ayrýca tek maç üzerinden canlý bahisler oynanabilmekte. Binlere farklý müsabakaya yüksek oranlardan canlý bahis oynayabileceðiniz bir hizmet sizleri beklemekte. Sadece spor bahisleri de deðil. E-sports bahisleri, sanal bahisleri gibi farklý bahis seçenekleri de bulunmakta.
    Superbetin sayesinde gerçek bir casino hizmetine de ulaþabilirsiniz. Gerçek casino salonlarýndan canlý kurpiyerlerin sunumlarýyla 4K görüntü kalitesi üzerinden hizmet alýn. Canlý casino oyunlarý ve binlerce farklý slot oyunlarý sizleri beklemekte.
    Süperbetin bahis ve casino oyunlarýndan saðladýðýnýz kazançlarýnýzý sorun yaþamadan çekebilirsiniz. Sonuç olarak istediðiniz finansal yöntem üzerinden para yatýrma ve çekme iþlemlerinizi kolay bir þekilde yapýn.
    Sizlerde Süperbetin giriþ yaparak avantajlý bahis ve casino dünyasýna giriþ yapabilirsiniz.
    Süperbetin kullanýcýlarý para yatýrma ve çekme iþlemlerinizi yapabilirsiniz. Sonuç olarak BTC, usdt gibi coinler üzerinden finansal iþlem sunan sitelerden birisidir.
    Geniþ bir iddaa bülteni üzerinden binlerce farklý müsabakaya ayrýca yüksek oranlardan canlý iddaa oynayýn.
    Gerçek casino salonlarýndan özel olarak bir hizmete ulaþýn. Canlý casino oyunlarý ve slot oyunlarý superbetin dünyasýnda sizleri beklemekte.

    ReplyDelete