Skip to content

Iptv Assist

Learn More from us

Menu
  • HOW TO
  • Firestick
  • Chromecast
  • PC Apps
  • Lg Smart TV
  • IPTV Services
  • Automation Testing
  • Smart TV
  • Software Testing Tools
  • Contact Us
Menu

QTP Tutorial #21 – How to Make QTP Tests Modular and Reusable Using Actions and Function Libraries

Posted on March 19, 2023

Best Iptv Service Provider 2023 With 40k+ Channels And 100k+ VOD . 24/7 Suppport . Paypal Supported

QTP Actions and Action Properties

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

Actions divide a test into logical units. This aids in highly readable tests and ensures that modularity is achieved.

Recommended IPTV Service Providers

  1. IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
  2. IPTVRESALE – Rating 5/5 ( 200+ Reviews )
  3. IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
  4. IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
  5. IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
  6. IPTVTOPS – Rating 5/5 ( 43 Reviews )

 

There are 3 types of QTP Actions:

  • Reusable – Only these can be called multiple times within the same or different tests.
  • Non-Reusable – These cannot be called by any other actions.
  • External Actions – A reusable action when called from another action becomes an external action in the called action.

=> Click Here For The QTP Training Tutorials Series

Using Actions and Function Libraries

How to Use QTP Actions in Tests?

#1) By default all new actions are reusable.

#2) Every action has its own “Action” datasheet or a local sheet.

#3) Call to an existing action in another test can be inserted by using the menu option: “Insert -> Call to an existing action -> (Choose test/action)”

QTP Actions

#4) The statement or action call inserted in the current test will be as follows:

 RunAction “Action2[Testname]”, oneiteration 

#5) The action will be called as many times as the action called properties is specified for the parent action.

For Example,
Action2 is a reusable action in Test2. It is called on every iteration in the data table of Test2.
Action1 is the action that calls Action2 in Test1.
Action1 runs only once.
Then, Action2 will run only once irrespective of how many times it was called in Test2.

#6) A previously reusable action can be changed to become non-usable and vice versa.

#7) When a previously reusable action is marked as non-reusable, then the test that calls the action fails and a warning message is displayed to the user.

#8) In the previous article, we have seen how parameters can be passed “To” and “From” actions. To define this, you can do one of the following:

  • Choose the action from the keyword view, right-click and choose Action Properties.
  • While in the action in the expert view, select Edit ->Action Properties from the menu.

#9) The dialog box appears with General (name, description, reusable or not), Parameters(i/p or o/p), associated repositories (can associate another action’s OR), and Used by tabs.

QTP Actions

#10) To send parameters to action, the general syntax is:

 RunAction “Action Name”. Oneiteration, i/p parameters, o/p parameters 

Given below are some of the ways in which you can utilize the output value of an action in your test depending on your requirement:

a) Action o/p value (value returned by a called action) can be stored in a variable.

 RunAction “Action1”,OneIteration, i/pvalues, x, x being the variable 

b) Action o/p value can be stored in an environment variable.

To create an environment variable choose “File -> Settings -> Environment tab”, in the ‘Variable Type’ drop-down choose user-defined and click + and ‘Add new environment Parameter’ – enter the name (env_Var) and an empty value and click OK.

QTP Actions

To assign the o/p value to this variable,

 RunAction “Action1”,OneIteration, i/pvalues, Environment(“env_var”) 

c) Action o/p values can be stored in the data table column.

 RunAction “Action1”, OneIteration, i/pvalue, DataTable(“A”, dtGlobalsheet) 

QTP Functions and Function Libraries

Though there are many built-in functions available in the QTP for the tester, there might still be instances when you might want to perform a specific operation and make those steps reusable.

You can do that by creating user-defined functions, putting them in a separate file, associating it with the test, and having the function name work as a keyword for that particular test.

So by definition, a function is nothing but a piece of code that performs a certain task.

Let’s create a function library now:

Use the menu option “File -> New -> Function Library” or “Shift+Alt+N” or click on the “New” drop-down option on the menu and choose “Function library”.

QTP will open up an editor, very similar to the keyword view of a test. You can write your code here. I am going to include statements that will log a user into the gmail.com page.

QTP Functions

Function gmailLogin(uname, pwd)
SystemUtil.Run "iexplore.exe", "http://www.gmail.com"
Browser("Gmail: Email from Google").page("Gmail: Email from Google").Sync
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set uname
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").SetSecure  pwd
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click
End Function

Once you are done with writing the code, “Save” the function library by choosing the required name and location on your computer.

Note: The function library does not get auto-included in any of your tests. You are going to have to do it explicitly.

Given below are the steps to associate a Function Library into your test:

Step #1: Open your test or create a new test.

Step #2: Depending on the settings you have on your IDE, you might have the resources pane already available to you. If not, choose the menu option “View -> Resources” and this displays the pane.

Step #3: Right-click on the “Associate Function libraries”, click the “Associate Function library” option, and choose the library file you created earlier.

QTP Functions

Step #4: There will be a message that asks for the tester’s confirmation before converting the path to a relative path. This is done to make sure that the test does not fail if the files are moved as long as the same hierarchy is followed.

Click yes on this dialog box:

QTP Functions

Step #5: It will appear under this node from now on and that is how you verify if your association has worked or not.

Step #6: Once you have associated the library, make sure you save your test.

From now on if there is a statement in my test that is as follows, then it will invoke the function in the library and execute the steps in there.

 gmailLogin(“swatiseela”,”akihad989080890”) 

In the statement above, you are passing constant username and password values. But if you choose to, you can pass on the values from the data table too.

 gmailLogin(DataTable("SignInName", dtGlobalSheet), DataTable("GPassword", dtGlobalSheet)) 

You can have more than one function in your library files and you can have more than one library file associated with your test.

Conclusion

This concludes our Function Libraries and Actions.  These two topics are crucial for a tester as they make all your tests more modular and reusable.

The next topic is going to be on Object repositories (OR). We will discuss how to create, associate, and work with shared ORs and OR managers.

=> Visit Here For The QTP Training Tutorials Series

Please feel free to post your questions and comments.

Related

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • IPTV List: Best iptv lista 2023
  • IPTV Premium: Best Premium IPTV Service Provider List And Benefits
  • Nikon IPTV Review: Over 10,000 Live Channels for $12/Month
  • Iptvwings. Com Review: +18000 Live IPTV Channels ,+70000 Movies, +40000 TV show For $15/1 month
  • IPTVUNO Review: More Than 16000 Live TV channels, 55,000 Movies & VOD For $15/Month

Recent Comments

  1. IPTV List: Play lista iptv 2022 - Iptv Assist on Best IPTV Player in 2023 for Watching Live TV
  2. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on FileLinked – How to Install on Firestick/Fire TV and Android Devices
  3. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on 50+ Best IPTV Service Providers for Streaming Live TV 2023
  4. XoomsTV IPTV – Over 11,000 Channels & VOD for Under $13/Month on Best VPN for IPTV in 2023 and How to Install on Firestick/Android
  5. Voodoo Streams IPTV Review – Over 12,000 Channels for $11/Month - Iptv Assist on Dynasty TV IPTV Review – Over 6,000 Channels for $10/Month

Archives

  • March 2023

Categories

  • Activate
  • Agile Testing
  • Alternatives
  • Android
  • APK
  • Apple TV
  • Automation Testing
  • Basics of Software Testing
  • Best Apps
  • Breakfast Hours
  • Bug Defect tracking
  • Career in Software Testing
  • Chromebook
  • Chromecast
  • Cross Platform
  • Database Testing
  • Delete Account
  • Discord
  • Error Code
  • Firestick
  • Gaming
  • General
  • Google TV
  • Hisense Smart TV
  • HOW TO
  • Interview Questions
  • iPhone
  • IPTV
  • IPTV Apps
  • Iptv Service SP
  • IPTV Services
  • JVC Smart TV
  • Kodi
  • Lg Smart TV
  • Manual Testing
  • MI TV
  • Mobile Testing
  • Mod APK
  • newestiptv.com
  • News
  • Nintendo Switch
  • Panasonic Smart TV
  • PC Apps
  • Performance Testing
  • Philips Smart TV
  • PS4
  • PS5
  • Python
  • QA Certifications
  • QA Leadership
  • QA Team Skills
  • Quality Assurance
  • Reddit
  • Reviews
  • Roku
  • Samsung Smart TV
  • Screenshot
  • Selenium Tutorials
  • Sharp Smart TV
  • Skyworth Smart TV
  • Smart TV
  • Soft Skills For Testers
  • Software Testing Templates
  • Software Testing Tools
  • Software Testing Training
  • Sony Smart TV
  • Sports
  • Streaming Apps
  • Streaming Devices
  • Tech News
  • Test Management Tools
  • Test Strategy
  • Testing Best Practices
  • Testing Concepts
  • Testing Methodologies
  • Testing News
  • Testing Skill Improvement
  • Testing Tips and Resources
  • Toshiba Smart TV
  • Tutorials
  • Twitch
  • Types of Testing
  • Uncategorized
  • Vizio Smart TV
  • VPN
  • Web Testing
  • What is
  • Xbox
©2023 Iptv Assist | Design: Newspaperly WordPress Theme