Functions | Zoho QEngine Help

Functions

In a nutshell
Functions are reusable test cases built for actions that repeat across multiple test cases. A function is created once and called using its link name or the call function task, as many times as needed within the same test case or across different ones. Passing different arguments each time it is called lets the same function handle varying input scenarios without requiring duplicate steps.
 

Overview

Functions are test cases that can be reused for a specific task and can be called multiple times throughout a test case with or without different arguments. For example, take the case of an ecommerce shop. Test cases like Add to Cart are common actions inside their web services and mobile applications. These test cases are repeated actions and can be listed under the functions category.
 
Functions can be referred to in test cases using its Link Name or using the task call function.

Create Function

Creating a function is similar to a creating a test case. To do so:
  1. Click Create Test Case.

  1. Enter the test case details, such as Name, Link Name, and Module to which it needs to be added. Additionally, providing a Description offers a better overview of the test case, but is not mandatory. 

The link name will be unique for each function and will be auto-filled by default, similar to the test case name. They should be descriptive and accurately reflect the purpose of the function. For example, if your test case name is Contact Us, the link name would be contact_us by default. However, they can be edited as per the following conditions:
  • The link name only supports lower case letters. For example, if the test case name is Addtocart, the link name would be addtocart.
  • Special characters are not supported. They will be replaced with underscores (_). For example, if the test case name is Replacement&Return , the link name would be replacement_return.
  • If there are two or more special characters consecutively, they will be replaced with a single underscore character. For example, if the test case name is details & @contact, the link name would be details_contact.
  1. Select the Mark test case as a function checkbox below the description to convert the test case into a function.
Notes
Note: If the test case isn't marked a function, then it's considered as a regular test case.
  1. Mention the return type of the function. This specifies the data type of the value that the function will return after its execution. For example, if we create a function to greet every user inside an ecommerce site, then the function is a void type, as it doesn't have a return statement. It will simply print a greeting message for every user. However, if the function was created to sum the total price of a product and the price value are integer data types, then the function is an integer type as it gives an integer sum in return.
  1. Specify the arguments, if any. The arguments of a function are the input values passed when it is called inside a test case or another function, which the function can use to perform its operations. For example, an ecommerce function to show featured products doesn't take arguments but displays products, while a function calculating the total price takes quantity and price per unit arguments and returns the total cost.

Notes
Note: The fields return type and specify arguments will only be enabled once you check the box to make the test case a function.
  1. Once the required details are filled, click Create.

Using functions 

  • To use functions in a test case or an existing function inside builder mode, simply call the function using the Call Function task. Drag-and-drop the call function task from the task panel to the editor. The right panel for the arguments will have a drop-down menu. Choose the module from the drop-down menu to select the desired function.

  • For editor mode, simply refer to it inside using the format: <module_link name>.<function_link name>(arguments);
Parameter
Description
module_link_name
Link name of the module in which the function has been defined
function_link name
Name of the function to be invoked
arguments
Parameters of the function, if any
 
For example, if the module name is Shopping and the test case name is Add to Cart, in this case will be shopping.add_to_cart();
 
 
Let's look at an example to understand how functions are used inside test cases. Take the case of the Add to Cart function of the website Zylker Watches. The tester created a new function to handle the Add to Cart functionality in an ecommerce web application, in order to implement the function inside the test case Buy a Product.
  1. The test case belongs to the Shopping module. The Add to Cart function is called inside the Buy a Product test case. This automatically adds the function's script in the test case, as displayed below:


Understanding the use of functions is crucial. Now that we have learned how to create functions, the next step is to learn how to use them. Choose between recorder, or editor and builder mode to write the functions. Execute and analyze the functions with the preview run options: Web, Android, and iOS, for more reliable and reusable function scripts.

  1. Web Testing using Builder and Editor mode
 
 

 


In a nutshell
Functions are reusable test cases built for actions that repeat across multiple test cases. A function is created once and called using its link name or the call function task, as many times as needed, within the same test case or across different ones. Passing different arguments each time it is called lets the same function handle varying input scenarios without requiring duplicate step.

        Create. Review. Publish.

        Write, edit, collaborate on, and publish documents to different content management platforms.

        Get Started Now


          Access your files securely from anywhere

            Zoho CRM Training Programs

            Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

            Zoho CRM Training
              Redefine the way you work
              with Zoho Workplace

                Zoho DataPrep Personalized Demo

                If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

                Zoho CRM Training

                  Create, share, and deliver

                  beautiful slides from anywhere.

                  Get Started Now


                    Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                    BOOK A SESSION







                                Quick LinksWorkflow AutomationData Collection
                                Web FormsEnterpriseOnline Data Collection Tool
                                Embeddable FormsBankingBegin Data Collection
                                Interactive FormsWorkplaceData Collection App
                                CRM FormsCustomer ServiceAccessible Forms
                                Digital FormsMarketingForms for Small Business
                                HTML FormsEducationForms for Enterprise
                                Contact FormsE-commerceForms for any business
                                Lead Generation FormsHealthcareForms for Startups
                                Wordpress FormsCustomer onboardingForms for Small Business
                                No Code FormsConstructionRSVP tool for holidays
                                Free FormsTravelFeatures for Order Forms
                                Prefill FormsNon-Profit

                                Intake FormsLegal
                                Mobile App
                                Form DesignerHR
                                Mobile Forms
                                Card FormsFoodOffline Forms
                                Assign FormsPhotographyMobile Forms Features
                                Translate FormsReal EstateKiosk in Mobile Forms
                                Electronic Forms
                                Drag & drop form builder

                                Notification Emails for FormsAlternativesSecurity & Compliance
                                Holiday FormsGoogle Forms alternative GDPR
                                Form to PDFJotform alternativeHIPAA Forms
                                Email FormsFormstack alternativeEncrypted Forms

                                Wufoo alternativeSecure Forms

                                TypeformWCAG


                                    All-in-one knowledge management and training platform for your employees and customers.

                                              Create. Review. Publish.

                                              Write, edit, collaborate on, and publish documents to different content management platforms.

                                              Get Started Now




                                                                You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                    Manage your brands on social media


                                                                      • Desk Community Learning Series


                                                                      • Digest


                                                                      • Functions


                                                                      • Meetups


                                                                      • Kbase


                                                                      • Resources


                                                                      • Glossary


                                                                      • Desk Marketplace


                                                                      • MVP Corner


                                                                      • Word of the Day


                                                                      • Ask the Experts


                                                                        Zoho Sheet Resources

                                                                         

                                                                            Zoho Forms Resources


                                                                              Secure your business
                                                                              communication with Zoho Mail


                                                                              Mail on the move with
                                                                              Zoho Mail mobile application

                                                                                Stay on top of your schedule
                                                                                at all times


                                                                                Carry your calendar with you
                                                                                Anytime, anywhere




                                                                                      Zoho Sign Resources

                                                                                        Sign, Paperless!

                                                                                        Sign and send business documents on the go!

                                                                                        Get Started Now




                                                                                                Zoho TeamInbox Resources





                                                                                                          Zoho DataPrep Demo

                                                                                                          Get a personalized demo or POC

                                                                                                          REGISTER NOW


                                                                                                            Design. Discuss. Deliver.

                                                                                                            Create visually engaging stories with Zoho Show.

                                                                                                            Get Started Now








                                                                                                                                • Related Articles

                                                                                                                                • File Functions

                                                                                                                                  1. In a nutshell Zoho QEngine provides built-in file functions that allow you to retrieve data and validate files within test scripts. 1.1 Availability These functions are available for : Files retrieved using the invoke URL method Files saved ...
                                                                                                                                • isFile()

                                                                                                                                  1. Overview The isFile() function checks whether the input is a valid file object. It returns a boolean value (true or false) based on whether the specified input can be treated as a file. This is especially useful before performing further file ...
                                                                                                                                • getFilecontent()

                                                                                                                                  1. Overview The getFilecontent() function returns the content stored in the specified input file. It is commonly used in test cases to validate file data, read values for further logic, or check against expected content. 2. Syntax <variable> = ...
                                                                                                                                • getFileSize()

                                                                                                                                  1. Overview The getFileSize() function returns the size of the specified file in bytes. This is useful for validating if a file has been completely downloaded, meets expected size criteria, or to perform conditional logic based on file size. 2. ...
                                                                                                                                • getFileName()

                                                                                                                                  1. Overview The getFileName() function returns the name of the specified input file, including its extension. This is useful for validating file naming conventions or confirming that the expected file has been retrieved or downloaded. 2. Syntax ...
                                                                                                                                  Wherever you are is as good as
                                                                                                                                  your workplace

                                                                                                                                    Resources

                                                                                                                                    Videos

                                                                                                                                    Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                    eBooks

                                                                                                                                    Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                    Webinars

                                                                                                                                    Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                    CRM Tips

                                                                                                                                    Make the most of Zoho CRM with these useful tips.



                                                                                                                                      Zoho Show Resources