Document toolboxDocument toolbox

Header

Work with Custom Action Module

Though Qualitia covers most of the actions required for automation testing, there might still be a need to add some more actions to Qualitia based on the project requirements. Qualitia allows you to develop your own actions and make them available to use while automating test cases for the application under test.  

The custom action module allows you to develop and maintain these actions in a convenient way.  

This module provides:

  • A guided and easy to follow guidelines to develop custom actions,

  • Make code templates, required dependencies, and sample codes easily available to anyone who can create custom actions,

  • Maintain the custom action code just like you maintain tasks and test cases using a version control tool like SVN or Git, and

  • Share these custom actions with other project members for use.

Working with Custom Actions for Web and Mobile Projects

After you import all your existing custom actions in Qualitia, you can now create, modify, search, or view the custom action codes in Qualitia automation studio itself. In the cases of multi user scenario, you can share these actions easily with other team members just as you share your tasks and test cases.

Also, any of the project members can update the code using an Eclipse IDE based on the requirements. You can launch an Eclipse IDE from Qualitia automation studio itself.

Importing Existing Custom Actions Created in Previous Qualitia Versions

If you have created custom actions using a Qualitia version before v7.0.0, then you can import your existing set of custom actions into Qualitia. Importing custom actions is simple 3 step process.

In order to import and streamline the custom actions with other project data in Qualitia, you must add all the java source files at one place. In case you do not have source files for some actions, you can generate the source code files easily using these commands mentioned below.

  1. Launch command prompt.

  2. Navigate to the %localappdata%\QualitiaWDClient\app-7.1.0\Dist folder.

  3. Enter the following command:

    “java -jar jd-cli.jar "<CLASS_FILE_SOURCE_PATH>" -od "<DESTINATION_FOLDER_TO_SAVE_SOURCE_CODE>"

    C:\Users\<HOSTNAME>\AppData\Local\QualitiaWDClient\app-7.1.0\Dist>java -jar jd-cli.jar "D:\ClassFiles" -od "D:\JavaFiles" 21:21:06.078 INFO jd.cli.Main - Decompiling D:\ClassFiles 21:21:06.095 INFO jd.core.output.DirOutput - Directory output will be initialized for path D:\JavaFiles 21:21:06.412 INFO jd.core.output.DirOutput - Finished with 2 class file(s) and 1 resource file(s)

    Post executing this command, source code files will be added at the destination folder. You can use them now to build and compile Eclipse project.

To create and compile custom action project:

  1. Launch Eclipse and create a new java project using an execution environment as JRE 1.8.

  2. Set the bin folder as an output folder.

  3. Add new folder and name it as lib.
    The complete folder hierarchy will look something like this in the project directory.

     

  4. Add all the existing custom action files in this directory.
    Before you start adding custom action-related data into these sub folders, ensure that the code is working fine.

    1. Add all the dependency files in the lib folder. 

    2. Add all the compiled class files in the bin folder.

    3. Add all the java source files in the src folder. 
      Ensure you add all your dependent jars in lib folder and provide the relative path for these jars in Build Path with the correct sequence.

  5. Compile and build the Eclipse project.
    Actions are now ready to be imported.

You can import the existing set of custom actions in Qualitia to share with the other project members easily.

 Ensure the class files you are providing have all the custom actions functions present for which you have provided the metadata. A single class file can contain functions for multiple custom actions.

  1. Log on to automation studio as a user with Manage Custom Action Code privileges. 

  2. Navigate to the project in which you want to import the custom action code and then click Develop > Custom Actions.
    You will see the notification about importing custom actions on the top. This option is visible only if the project contains any custom actions that are not yet imported.

  3. Click Import.

  4. Provide path to the the Eclipse project which we have created and compiled earlier.

  5. After importing all the custom action files successfully, click Close.
    Eclipse project directory will be copied under Qualitia project path with all the sub-folders mentioned earlier (bin, lib, src, and so forth).
    The Custom Action Repository Path under Configuration Settings will be set automatically to this new directory created under Qualitia Project Path.

  6. In case there are any issues while importing the actions, these will be listed which can be exported in the HTML report.

  7. Refer to the troubleshooting section to resolve the errors.

    Points To Know:

    • For example, if you add a Qualitia Class "com.security.login", then this file creates a package and a java file called as "com.security" and "login.java" respectively.

    • The Custom Object Class is a user-friendly alternate name for a Qualitia Class, which you can specify.

To add the missing Qualitia jar file in the lib folder, follow these steps:

  1. Navigate to %localappdata%\QualitiaWDClient\app-8.6.0.XXX\WebDriver.

  2. Copy the qualitia-8.6.X jar file and paste it in the lib folder under the following directory: Projectpath/Projectname_projectdb/Projectname_QASJavaproject/

  3. Launch Eclipse by navigating to Qualitia > right-click on project name (Projectname_QASJavaproject) > Build path > Configure Build Path.

  4. Now, go to Libraries > Add jars.

  5. Expand the Projectname_QASJavaproject and the lib folder.

  6. Select the qualitia-8.6.0 jar and click OK.

Creating a Custom Action for a Web/Mobile Project

Pre-Requisites

Before you start creating custom actions in Qualitia, ensure you meet the following prerequisites 

Creating New Custom Actions

If you have existing set of custom actions which you are using while developing test cases and tasks, you must import them in Qualitia.

For more information on importing existing custom action code in Qualitia, click here.

After you import the existing set of custom actions in Qualitia you can start creating new actions.

For newly created projects, you can start creating custom actions right-away. 

To create new custom action in Qualitia:

  1. From the Expand Menu, click Develop.

  2. Click the Custom Actions tab.

  3. Click the Add Button (  ) or Create Custom Action button.
    The Custom Actions screen appears.

  4. Select Base Class.
     The Custom Object Class file name including its file path should not exceed 256 characters when you are using Git/Bitbucket as a source control system for maintaining project artifacts.

  5. Do one of the following:

    • To add a new Qualitia Class:

      1. Click the Plus button next to Custom Object Class to add a custom object class by mapping to the Qualitia Class that you want to add.

      2. Enter the java class file name without its extension along with the package name (if required), in Qualitia Class.

    • To select a pre-defined Qualitia Class that is mapped to a Custom Object Class:

      • From the Custom Object Class drop-down list, select a pre-defined custom object class.
        The associated Qualitia Class is selected automatically.

        Points To Know:

        • For example, if you add a Qualitia Class "com.security.login", then this file creates a package and a java file called as "com.security" and "login.java" respectively.

        • The Custom Object Class is a user-friendly alternate name for a Qualitia Class, which you can specify.

         

  6. Enter Action Name, Description and Function Name for the action to be created.

  7. In the Properties section, click Add.
    A new line will be added in the grid.

  8. Add Parameter Name, Description, ArgDataType for the parameter, and select whether this parameter is mandatory.

    1. To save the action, click Save.

    2. To save the action and launch the code template in Eclipse IDE, click Save and Launch Eclipse.

  9. Close the Welcome on the IDE window to see your auto-generated custom action code template.

  10. Import the pre-created Custom Action Java project workspace into Eclipse workspace.
     This is a one-time activity for a project.

    1. To import the pre-created workspace, right-click Package Explorer, and select Import from the context-menu.

    2. On the Import window, under the General section, select Existing Projects into Workspace and then click Next.

    3. In the Select root directory section, click the Browse button, select <PROJECTNAME>_QASJavaproject and click Finish.
      You will find this directory under Qualitia project path.

  11. In Eclipse IDE, from the Window menu, select Preferences.

  12. Select General > Workspace > select Refresh using native hooks or polling.

  13. Click Apply and Close.

  14. Ensure you do not change the method signature and provide only the method body. Changing the signature in code may break your action in Qualitia.

  15. In the editor, add the custom action code in the provided template for your custom action.

  16. To add the dependent jars, do the following in the order listed:

    1. Add the dependent jar files in the lib folder under the project.

    2. Right-click the Project, point to Build Path, and then select Configure Build Path.

    3. Click Libraries > Add JARs.

    4. Under Jar Selection window, expand the Project folder.

    5. Under the lib folder, select the dependent Jar, and click Ok

    6. Click Apply and Close.

  17. Build the project and close the Eclipse IDE.
    To work this custom action code in the Qualitia automation test cases, you must build the project successfully.
    You can now use this newly created custom action while developing task and test cases in Qualitia.

Once you have closed the Eclipse IDE, Qualitia automatically commits the code to the version control system (if configured) and makes the code available to other Qualitia project members.

Recommendations and Rules for Custom Actions

Generic Recommendations

For creating the custom actions for Selenium Webdriver, you need to create the action in Java and then map the action into Qualitia Automation Studio. You can use any IDE tool like Eclipse.

The following are some rules that must be considered when creating custom actions:

  • The parameter data types supported by Qualitia are String and Array. If an array parameter is used in Qualitia for the custom action, then custom action parameter should be of the type Object in Custom Action function. The parameter can then be type-casted into the data type which is required in the action.
    For example, the object parameter can be type-casted into the array list.

  • Based on the standard Java coding rules, actions should not be created in the default package. For better maintenance, it is recommended to use user-defined packages for development.

  • It is recommended to put a prefix when defining a name for new custom actions for easy identification.

  • No two custom actions can have the same function name in the same class. Function overloading is not allowed. Duplicate function names in different classes are allowed (not recommended). 

  • Once the action is mapped into Qualitia and used in a test case, do not change the existing signature or other details of the actions or the classes created. The functionality of the action can be modified. Do not delete the custom actions or custom classes that are used in test cases.

  • If the custom action belongs to any object type (such as WebEdit, WebElement, and so forth), ensure you add the objectInfo data type parameter while developing the code of an action.

  • While mapping actions into Automation Studio, it is important to map the action using <package.class> hierarchy. 

  • Objects should be added under appropriate Qualitia classes while mapping custom actions into Qualitia Automation Studio

New Recommendations from Qualitia v8.0.0

Qualitia has come up with a new set of rules for creating custom actions in Qualitia 8.0.0 and later. If you have created custom actions to Qualitia version earlier than v8.0.0, then you must edit the existing ones with the following rules.

Making a New Class for Recommendations

You can create a custom class consisting of your custom actions. The newly generated class can be added in the same package as that of the already supported actions. 

You must ensure that in the test case, the ‘name’ and ‘qClass’ fields of action are set to the correct name of the action and class containing that action respectively. Qualitia now uses the concept of java reflection through which the action mentioned in ‘name’ and class mentioned in ‘qClass’ is called directly for action execution. The following example demonstrates how to make a new class for custom actions. 

package <QASpackagename>; import com.qualitia.execution.ActionResponse; import com.qualitia.execution.ApplicationLogger; import com.qualitia.models.testcase.ExecutionResult; import com.webdriverfw.Wrappers.General; <QASimportlist> public class <QASclassname> extends General { //Define your customs actions here }

Writing Custom Actions in the Accepted Format

Qualitia now allows to write code for a custom in the following format. 

   package <QASpackagename>;  import com.qualitia.execution.ActionResponse;   import com.qualitia.execution.ApplicationLogger;   import com.qualitia.models.testcase.ExecutionResult;   import com.webdriverfw.Wrappers.General;    <QASimportlist>       public class <QASclassname> extends General {    //Define your customs actions here      }

As per the previous Qualita versions prior to v8.0.0 , the actions used to return integer value i.e 0,1,2,-1  which were used to indicate PASSED, FAILED, DEFECT, NOT-EXECUTED respectively .

The return value has been changed to ActionResponse. The actions return ActionResponse which contains 2 parameters Message and ExecutionResult. Before ActionResponse is returned during the execution of action, the required message and ExecutionResult must be set properly. The primitive datatypes allowed for action parameters are String and Array. 

ApplicationLooger

For actions specific to logs, you can use ApplicationLogger.  

  • applicationLogger.writeToInfoLog(""); 

  • applicationLogger.writeToErrorLog(""); 

The main purpose of ApplicationLogger is to create the ogs to understand the flow of execution. There are 2 types of logs supported for Qualitia: 

  • Info Log

  • Error Log

Show Link of File in Info Log Section 

Some custom actions need to write a file during its execution. You can view that file inside the Info Log of that custom action. If you want to view the file contents, then you can click the Link present in the Message section of Info. 

The following function needs to be called before returning Action Response to show the link of files inside the log section. 

showLinkOfFileInLogsSection(String sourceFilePath, ActionResponse actionResponse) 

The sourceFilePath denotes the file path you write during custom action execution, and actionResponse denotes the Action Response object. 

The Error logs must be in the catch block of Action. These logs can be seen in Qualitia report which is generated after the execution of the suite. 

Setting an Execution Result

While setting ExecutionResult, you can make use of ExecutionResult enum where the required results are available. 

  • ExecutionResult.PASSED is used to set when the action is passed.

  • ExecutionResult.FAILED is used to set when the action is failed. 

  • ExecutionResult.DEFECT is used to set when the action has a defect. 

  • ExecutionResult.NOT_EXECUTED is used to set when the action halts the execution.  

The message and ExecutionResult that has been set will appear in the final Qualitia report.

 Example:- 

Here is one brief example on writing custom Actions, showcasing how it was done in old version and how it is done in Qualitia 8.0.0 version. 

If you want to write a custom action for checking two strings are equal, you can do it as:  

 Adding a Failure Category for a Custom Action

You can add a pre-defined failure category or create a custom category for a custom action.

For more information, refer to .

You can add a new category and define new enum implementing Failure Calssification Interface as: 

 Use it in actions as: 

 You can create a new  category as shown in the following: 

 1.) Using String :  

2.) Using String Constant : You can define constants to customize categories in a separate class. 

Use it in actions as:- 

Qualitia Public APIs for Custom Actions

Qualitia has shared the APIs to create custom actions. Earlier, Qualitia used to provide with public static variables and methods.

getWebDriver() 

This method is used to get the webdriver being used. The method is an alternative to QualitiaSelenium.getDriver() 

For example, if you want to find an element on browser using ID, user can do it as: 

In Qualitia 8.0.0: 

                element = getWebDriver().findElement(By.id(locator)); 

            } 

In earlier versions: 

                element = QualitiaSelenium.getDriver().findElement(By.id(locator)); 

            }      

getMobileDriver() 

This method is used to get the mobile driver being used. The method is an alternative to QualitiaMobile.getDriver(). 

For example, If you want to find an element on browser using ID, user can do it as: 
In Qualitia 8.0.0: 

if (locatorType.equalsIgnoreCase(CONSTANTS.XPATH)) { 

                element = getMobileDriver().findElementByXPath(By.id(locator)); 

}

In earlier versions: 

if (locatorType.equalsIgnoreCase(CONSTANTS.XPATH)) { 

                element = QualitiaMobile.getDriver().findElementByXPath(By.id(locator)); 

            }      

storeData(String key, String value) 

This method is used to store environment data in StoreHashMap. 

The method is an alternative to FwUtil.storeData(). 

getStoredData(String key) 

This method is used to get the value of particular key stored in StoreHashMap. 

The method is an alternative to Controller.STOREHASHMAP.get(). 

storeDataContainsValue(String value) 

This method is used to find if Storehashmap has the particular value present or not.  If it returns true then the Storehashmap has value else value is not present as store data.   

The method is an alternative to Controller.STOREHASHMAP.containsValue(). 

removeFromStoreData(String key) 

This method is used to remove store data with particular key from StoreHashMap. 

The method is an alternative to Controller.STOREHASHMAP.remove() 

getStoredDataAsObject 

This method is used to get stored data as Objects. 

storeDataAsObject(String key, Object value) 

This method is used to store environment data  as objects in StoreHashMap. 

The method is an alternative to FwUtil.storeData(). 

storeData(Map<String, String> storeMap) 

This method is used to store environment data in StoreHashMap where all the data is stored in storeMap along with their keys. 

The method is an alternative to FwUtil.storeData(). 

storeDataAsObject(Map<String, Object> storeMap) 

This method is used to store environment data  as objects in StoreHashMap where all the object data is stored in storeMap along with their keys. 

storeDataContainsKey(String key) 

This method is used to find if Storehashmap has the particular key present of not. 

If it returns true then the Storehashmap has key else key is not present as store data. 

The method is an alternative to Controller.STOREHASHMAP.containsKey() 

setCurrentWebExecutionPlatform(value)  

This method is used to set the value of "CurrentWebExecutionPlatform".  

The value can either be "DESKTOP" or "MOBILE" which can be set using "WebExecutionPlatform.DESKTOP" and "WebExecutionPlatform.MOBILE" respectively.  
This can be used when the testcase switches platforms while execution.  

The method is an alternative to  QualitiaTestCase.setCurrentWebExecutionPlatform(). 

For example: If user wants the current action to execute on Desktop, he can set it as: 

In Qualitia 8.0.0: 

setCurrentWebExecutionPlatform(WebExecutionPlatform.DESKTOP) 

In earlier versions: 

QualitiaTestCase.setCurrentWebExecutionPlatform(WebExecutionPlatform.DESKTOP); 

getCurrentWebExecutionPlatform() 

This method is used to get the value of "CurrentWebExecutionPlatform".  The value can either be "WebExecutionPlatform.DESKTOP" or "WebExecutionPlatform.MOBILE".  

Also, this method can be used to know which platform is the testcase running on currently. 

The method is an alternative to  QualitiaTestCase.getCurrentWebExecutionPlatform() 

For example: If user wants to do a particular operation when testcase is running on Desktop and another operation when testcase is running on Mobile, you can do it as: 

     In Qualitia 8.0.0: 

        if(getCurrentWebExecutionPlatform().equals(WebExecutionPlatform.DESKTOP) 

        { 

        //Desktop related operation 

        } 

        else if(getCurrentWebExecutionPlatform().equals(WebExecutionPlatform.MOBILE) 

        { 

        //Mobile related operation 

        } 

      In earlier versions: 

if(QualitiaTestCase.getCurrentWebExecutionPlatform().equals(WebExecutionPlatform.DESKTOP) 

        { 

        //Desktop related operation 

        } 

        else if(QualitiaTestCase.getCurrentWebExecutionPlatform().equals(WebExecutionPlatform.MOBILE) 

        { 

        //Mobile related operation 

        } 

isCurrentWebExecutionPlatformMobile()  

This method is used to know if the current platform that the testcase is executing on is MOBILE or not. It returns true if the current web execution platform is Mobile and returns false if it is Desktop.  

The method is an alternative to CommonUtil.isCurrentWebExecutionPlatformMobile().  

For example: If user wants to do a particular operation when testcase is running on Mobile, you can do it as:  

In Qualitia 8.0.0:  

       if(isCurrentWebExecutionPlatformMobile())    

        {  

        //Mobile related operation  

        }  

In earlier versions:  

if(CommonUtil.isCurrentWebExecutionPlatformMobile())  

        {  

        //Mobile related operation  

        }  

getIeDriverPath() 

This method is used to get the value of Internet explorer driver path which is provided in the execution profile. The value can be either given by user in the execution profile or if driver is downloaded automatically then it is a default value. 

The method is an alternative to GLOBALS.CONFIG_IE_DRIVERPATH. 

For example, if you want to set system property value for IE driver, you can do it as: 

In Qualitia 8.0.0: 

        System.setProperty("webdriver.ie.driver", GLOBALS.CONFIG_IE_DRIVERPATH); 

In earlier versions: 

        System.setProperty("webdriver.ie.driver", GLOBALS.CONFIG_IE_DRIVERPATH); 

getChromeDriverPath() 

This method is used to get the value of Google Chrome driver path which is provided in the execution profile. The value can be either given by user in the execution pofile or if driver is downloaded automatically then it is a default value. 

The method is an alternative to GLOBALS.CONFIG_CHROME_DRIVERPATH. 

For example, if you want to set system property value for IE driver, you can do it as: 

In Qualitia 8.0.0: 

        System.setProperty("webdriver.chrome.driver", GLOBALS.CONFIG_CHROME_DRIVERPATH); 

In earlier versions: 

        System.setProperty("webdriver.chrome.driver", GLOBALS.CONFIG_CHROME_DRIVERPATH);     

getFirefoxDriverPath() 

This method is used to get the value of Firefox driver path i.e. geckodriver which is provided in the execution profile.  

The value can be either given by user in the execution profile or if driver is downloaded automatically then it is a default value.  The method is an alternative to GLOBALS.CONFIG_FF_DRIVERPATH. 
For example, if you want to set system property value for IE driver, you can do it as:    

In Qualitia 8.0.0: 

        System.setProperty("webdriver.gecko.driver", GLOBALS.CONFIG_FF_DRIVERPATH);

In earlier versions: 

        System.setProperty("webdriver.gecko.driver", GLOBALS.CONFIG_FF_DRIVERPATH);       

getActionResponse() 

In previous versions of qualitia, all the action methods used to return int value. In latest engine, the return value of all the actions is ActionResponse. 

It has two parameters:  

  • A Message is a statement which you are provided with different outcomes of actions. 

  • An ExecutionResult is the output of the action which is pre-defined as PASSED, FAILED, DEFECT or NOT_EXECUTED. 

    For example, if a user wants to write a custom action for checking two strings are equal, you can do it as: 

In Qualitia 8.0.0: 

     public AcionResponse EqualStrings(String a, String b) 

    { 

    ActionResponse actionResponse = getActionResponse(); 

    if(a.equals(b)) 

    { 

    actionResponse.setMessage("they are equal"); 

    actionResponse.setExecutionResult(ExecutionResult.PASSED); 

    return actionResponse; 

    } 

    else 

    { 

    actionResponse.setMessage("they are not equal"); 

    actionResponse.setExecutionResult(ExecutionResult.FAILED); 

    return actionResponse; 

    } 

    }

     

    In earlier Qualitia versions: 

     public int EqualStrings(String a, String b) 

    { 

    if(a.equals(b)) 

    { 

    DataLogger.writeToDebugAndInfoLogs("they are equal"); 

    return 0; 

    } 

    else 

    { 

    DataLogger.writeToDebugAndInfoLogs("they are not equal"); 

    return 1; 

    } 

    }  

getStepId()  

This method is used to get the step ID. 

The method is an alternative to Controller.strStepID 

For example, if you want to get the ID of current step being executed, you can do as: 

    In Qualitia 8.0.0: 

        String stepid = getStepId(); 

    In earlier versions: 

        String stepid = Controller.strStepID; 

getTaskName() 

This method is used to get the name of the current task which is being executed. 

The method is an alternative to Controller.taskName 

For example, if you want to get the name of current task being executed, you can do it as: 

In Qualitia 8.0.0: 

        String Taskname = getTaskName();  

In earlier versions: 

        String Taskname= Controller.taskName; 

getTestCaseName() 

This method is used to get the name of current TC being executed.  

The method is an alternative to Controller.testCaseName   
For example, if you want to get the name of current testcase being executed, you can do it as:
In Qualitia 8.0.0:       
String TCname = getTestCaseName();     

In earlier versions: 

        String TCname = Controller.testCaseName;  

getTestCaseNameWithoutSpecialChars()    

This method is used to get the name of current TC being executed, without special characters like escape character(~). 

The method is an alternative to Controller.testCaseNameWithoutSpecialChars.    
For example, if you want to get the name of current testcase being executed, you can do it as:     

In Qualitia 8.0.0: 

        String TCname = getTestCaseNameWithoutSpecialChars();   

In earlier versions: 

        String TCname= Controller.testCaseNameWithoutSpecialChars;    

getScenarioName() 

This method is used to  get the name of scenario  being executed 

The method is an alternative to Controller.scenarioName 

For example, if you want to get the name of current scenario being executed, you can do it as: 

    In Qualitia 8.0.0: 

        String scenarioName = getScenarioName(); 

    In earlier versions: 

        String scenarioName = Controller.scenarioName; 

getSuiteName() 

This method is used to  get the name of current suite being executed.The method is an alternative to Controller.suiteName. 
For example, if you want to get the name of current suite being executed, you can do it as: 

In Qualitia 8.0.0: 

String suiteName = getSuiteName(); 

In earlier versions
String suiteName = Controller.suiteName; 

getObjectID() 

This method is used to  get current object Id. The method is an alternative to Controller.strObjectID. 
For example, if you want to get the ID of current object on the browser where he wants to set some value, you can do it as: 

In Qualitia 8.0.0: 

String objectID = getObjectID(); 

In earlier versions: 

String objectID = Controller.strObjectID; 

getIterationFolderPath() 

This method is used to get the Iteration folder path (report related data). 

The default value is "C:\Users\user.name\AppData\Local\Qualitia\WD\Client\ResultPath" 

This is an alternative to Controller.ITERATION_FOLDER_PATH 

For example, if you want to get the folder path where all the report related data is kept, you can do it as:  

In Qualitia 8.0.0:  

String itrFolderPath = getIterationFolderPath();

In earlier versions:  

String itrFolderPath = Controller.ITERATION_FOLDER_PATH;       

getSuitesDir() 

This method is used to get the suite Directory, the folder path where all the JSON files are present. This is the same as provided in config/startupSettings.json 

getMobileURL 

This method is used to get appium server URL where appium server is hosted.  

This is an alternative to GLOBALS.appiumServerURL 

For example, if you want to give a messgae regarding connection failure to appium server, he can do this as: 

  In Qualitia 8.0.0: 

        public static String APPIUM_NOT_RUNNING = "Failed to connect to Appium Server at " + 

            getMobileURL()+ ". Please verify Appium server host and port and make sure that " + 

            "it is started before executing the test case."; 

    In earlier versions: 

        public String APPIUM_NOT_RUNNING = "Failed to connect to Appium Server at " + 

            GLOBALS.appiumServerURL + ". Please verify Appium server host and port and make sure that " + 

            "it is started before executing the test case."; 

getCI_Tool() 

This method is used to get the value of CI_TOOL which is provided in the execution profile. 

The method is an alternative to GLOBALS.CONFIG_CITOOL 

For example, if a user wants to get an Instance of particular CI Tool, you can do it as: 

In Qualitia 8.0.0: 

private static final CIHandler _CIH = CIFactory.getInstance(getCI_Tool()); 

In earlier versions: 

private static final CIHandler _CIH = CIFactory.getInstance(GLOBALS.CONFIG_CITOOL); 

getTestCaseCounter() 

This method is used to get the iteration number of Testcase being executed. The method is an alternative to Controller.testCaseCounter. 

isDesktopExecution() 

This method is used to decide if the Execution platform is Desktop or not. It returns true when the executing platform is Desktop and returns false when execution platform is Mobile. 

This is an alternative to QualitiaSelenium.isDesktopExecution   

For example: If user wants to do a particular operation when testcase is running on Desktop, you can do it as:   

     In Qualitia 8.0.0:   

        if(isDesktopExecution())     

        {   

        //Desktop related operation   

        }   

 

     In earlier versions:   

        if(QualitiaSelenium.isDesktopExecution)   

        {   

        //Desktop related operation   

        }    

getProjectName() 

This method is used to get the project name as specified in the execution profile. 

The method is an alternative to GLOBALS.CONFIG_PROJECT. 

getUserName 

This method is used to get the user name as specified in the execution profile.  

The method is an alternative to GLOBALS.CONFIG_USERNAME.  

getBuildNum 

This method is used to get the Build number as specified in the execution profile.  

The method is an alternative to GLOBALS.CONFIG_BUILD_NUMBER . 

getReleaseNum 

This method is used to get the release number as specified in the execution profile.  

The method is an alternative to GLOBALS.CONFIG_RELEASE_NUMBER. 

getCreateInfoLog() 

This method is used to get the value of "CreateInfoLog" property as specified in the execution profile.   

If the value returns as true, then Info Log file is created.      

getCreateDebugLog() 

This method is used to get the value of "CreateDebugLog" property as specified in the execution profile.   

If the value returns as true, then Debug Log file is created and will be visible in report.

getCreateErrorLog() 

This method is used to get the value of "CreateErrorLog" property as specified in the execution profile.   

If the value returns as true, then Error Log file is generated and will be visible in report.

getShowReportAfterExec() 

This method is used to get the value of "ShowReportAfterExec" property as specified in the execution profile.   

If the value is true, then report is opened in a new browser window.

The report is generated and stored in Iteration folder but it is not opened automatically. 

getKeywordId() 

This method is used to get the ID of current function/action being executed. The method is an alternative to Controller.strKeywordID. 

getActionQClass() 

This method is used to  get the base class of current function/action being executed. The method is an alternative to Controller.strActionQClass. 

getKeywordName() 

This method is used to  get the name of current function/action executing. The method is an alternative to Controller.strKeywordName. 

isCustomAction() 

This method is used to decide if the currently executing action is custom action or Qualitia action. 

It returns true when the executing action is custom action and returns false when it is qualitia action. 

The method is an alternative to QualitiaSelenium.isCustomAction.     

For example, if a user wants to do a particular operation depending whether the current executing action is custom action or not, you can do it as:      

    In earlier versions: 

        if(QualitiaSelenium.isCustomAction) 

        {//operation} 

    In Qualitia 8.0.0: 

        if(isCustomAction()) 

        {//operation}  

getCapturePassImage 

This method is used to get the value of "CapturePassImage" property as specified in the execution profile.   

If the value is true, then screenshots are captured for steps that have executionResult as PASSED and if it is false then screenshots are not captured for PASSED steps.     

getCaptureFailImage 

This method is used to get the value of "CaptureFailImage" property as specified in the execution profile.     If the value is true, then screenshots are captured for steps that have executionResult as FAILED and if it is false then screenshots are not captured for FAILED steps.      

getCaptureDefectImage 

This method is used to get the value of "CaptureDefectImage" property as specified in the execution profile.   

    If the value is true, then screenshots are captured for steps that have executionResult as DEFECT and if it is false then screenshots are not captured for DEFECT steps. 

getHeadlessMode() 

= This method is used to get the value of "HeadlessMode" property as specified in the execution profile. If it return true then the browser is opened in headless mode else it is not. 

This is an alternative to GLOBALS.CONFIG_HEADLESSMODE.  

getFailStepOnBrowserScreenshotFailure 

This method is used to get the value of "FailStepOnBrowserScreenshotFailure" property as specified in the execution profile.      

 If the value is true, then if screenshots are not captured properly for PASSED steps  then they are changed to FAILED.If it is false then even if screenshots are not captured for PASSED steps, execution continues normally.  

getQualitiaPropValue(String key) 

This method is used to get value of any Qualitia property as specified in the execution profile. Here key is the Qualitia property name.  

 For example, if you want to know the value of "MobilePlatform", you can do it as: 

String mobilePaltform = getQualitiaPropValue("MobilePlatform"

getSelectedWaitMode() 

This method is used to get the value of "WaitMode" property as specified in the execution profile.   

The values can either be "EXPLCIT" or "IMPLICIT". 

This is an alterantive to QualitiaSelenium.getSelectedWaitMode().   

For example, if you want to do a certain task when waitmode is IMPLICIT, you can do it as: 

In Qualitia 8.0.0: 

if(getSelectedWaitMode() == CONSTANTS.WaitMode.IMPLICIT){ 

                // task  

            }   

In earlier versions: 

if(QualitiaSelenium.getSelectedWaitMode() == CONSTANTS.WaitMode.IMPLICIT){ 

                // task  

            }   

getIntervalTimeOut() 

This method is used to get the value of "IntervalTimeOut" property as specified in the execution profile.   

This is an alternative to QualitiaMobile.IntervalTimeOut. 

shutdownMobileDriverSession() 

This method is used for mobile driver cleanup process. 

This is an alternative to QualitiaMobile.quitMobileDriver().  

For example if a user has performed mobile operations using mobile driver and now wants to stop the driver, he can do itas : 

In Qualitia 8.0.0: 

 shutdownMobileDriverSession() 

In earlier versions: 

QualitiaMobile.quitMobileDriver();  

getSelectFrame() 

This is an alternative to Controller.EXECUTION_TESTCASES(Controller.testCaseCounter).getSelectFrame().

getBrowserName()  

This method is used to get the value of "BrowserName" property as specified in the execution profile.    

The values can be "googleChrome, firefox,iexplorer and safari". 

This is an alternative to QualitiaSelenium.getBrowser() 

For example, if a user wants to perform certain task on firefox browser, you can do it as:  

In Qualitia 8.0.0: 

  if (getBrowserName().equalsIgnoreCase(CONSTANTS.FIREFOX) 

//task 

}  

In earlier versions: 

if (QualitiaSelenium.getBrowser().equalsIgnoreCase(CONSTANTS.FIREFOX) 

//task 

}  

getParamTypes() 

This method is used to get the parameter types of an action. 

This is an alternative to QualitiaTestCase.paramTypes.  

For example, if a user wants to call a method using reflection, you can do it as: 

In Qualitia 8.0.0: 

    Method m = class.getMethod(functionName, getParamTypes());   

In earlier versions: 

    Method m = class.getMethod(functionName, QualitiaTestCase.paramTypes); 

getElementHighlighter 

This method is used to get the object of elementHighlighter class. It is used to highlight and unhighlight elements in browser.  

 For example, if a user wants to highlight and unhighlight and element, you can do it as: 

In earlier versions: 

    FwUtil.highlightElement(),FwUtil.unhighlightElement() 

In Qualitia 8.0.0: 

    getElementHighlighter.highlight(),getElementHighlighter.unhighlight()  

getKeywordFunction() 

This method is used to get the current function/action. This is an alternative to Controller.strKeywordFunction.

getKeywordQFunction() 

This method is used to get the Qfunction for particular keyword. 

This is an alternative to Controller.strKeywordQFunc. 

isMobileDriverAlreadyLaunched() 

This method is used to know if the mobile driver is already launched or not.  

If it returns true then the mobile driver has been launched else it is empty or its cleanup process is done. 

This is an alternative to QualitiaMobile.isDriverAlreadyLaunched().   

For example, if a user wants to print a message that Appium driver cannot be launched by checking, you can do it as:   

In earlier versions: 

    if (QualitiaMobile.isDriverAlreadyLaunched()) { 

            _LOGGER.info("Appium Driver is already launched.");} 

In Qualitia 8.0.0: 

    if (isMobileDriverAlreadyLaunched()) { 

            _LOGGER.info("Appium Driver is already launched.");}  

getCurrentMobileAppType() 

This method is used to get which type of mobile app is being used. The values can be "NATIVE" or "HYBRID". 

This is an alternative to QualitiaMobile.getCurrentMobileAppType()  

setWebPlatformSession(PlatformSession webPlatformSession) 

This method is used to set a new web driver. This is an alternative to QualitiaSelenium.setDriver() 

 for example, if you want to set a new browser web driver, you can do it as: 

In Qualitia 8.0.0: 

        PlatformSessionBuilder platformSessionBuilder = new PlatformSessionBuilder(PlatformType.BROWSER_NAME);             

        Future<PlatformSession> webDriverSessionFuture = platformSessionBuilder.buildAsync();     

        setWebPlatformSession(webDriverSessionFuture.get());   

setMobilePlatformSession(PlatformSession mobilePlatformSession) 

This method is used to set a new mobile driver. This is an alternative to QualitiaMobile.setDriver(). 
For example, if you want to set a new browser mobile driver, you can do it as: 

In Qualitia 8.0.0: 

        PlatformSessionBuilder platformSessionBuilder = new PlatformSessionBuilder(PlatformType.BROWSERNAME);             

          Future<PlatformSession> mobileDriverSessionFuture = platformSessionBuilder.buildAsync();     

          setMobilePlatformSession(mobileDriverSessionFuture.get());     

setActionLevelPageLoadTimeout(String pageLoadTimeout) 

This method is used to set the value of "ActionLevelPageLoadTimeout" property. 

The method is an alternative to QualitiaSelenium.setActionLevelPageLoadTimeout().

getPageLoadTimeout() 

This method is used to get the value of "PageLoadTimeout" property.  

The method is an alternative to QualitiaSelenium.getPageLoadTimeout(). 

getMaximumFindObjectTimeImplicit() 

This method is used to get the value of "MaximumFindObjectTimeImplicit" property.  

The method is an alternative to QualitiaSelenium.MaximumFindObjectTimeImplicit() 

 getMaximumFindObjectTimeExplicit() 

This method is used to get the value of "MaximumFindObjectTimeExplicit" property.  

The method is an alternative to QualitiaSelenium.MaximumFindObjectTimeExplicit() 

 getPollingInterval() 

This method is used to get the value of "PollingInterval" property.  

The method is an alternative to QualitiaSelenium.getPollingInterval().   

getMaximumFindObjectTimeForMobile() 

This method is used to get the value of "MaximumFindObjectTimeForMobile" property.  

The method is an alternative to QualitiaSelenium.maximumFindObjectTime().  

 getScreenCaptureMode() 

This method is used to get the value of "ScreenCaptureMode" property as specified in the execution profile. 

Values can be BROWSER or DESKTOP. 

The method is an alternative to GLOBALS.CONFIG_SCREEN_CAPTURE_MODE.

getIntervalTimeOutForMobile() 

This method is used to get the value of IntervalTimout property.  

The method is an alternative to QualitiaMobile.IntervalTimeOut().

getMobileUDID() 

This method is used to get the value of "MobileUDID" as specified in the execution profile. 

This property is used to specify the mobile on which the testcase should be run. 

The method is an alternative to GLOBALS.mobileUDID. 

 getMobileBrowser() 

This method is used to get the value of "MobileBrowser" as specified in the execution profile. 

This property is used to specify the mobile browser on which the testcase should be run. 

The method is an alternative to GLOBALS.mobileBrowserName.  

getAppiumServerURL() 

This method is used to get appium server URL where appium server is hosted.   

The method is an alternative to GLOBALS.appiumServerURL  
For example, if you want to give a messgae regarding connection failure to appium server, he can do this as:  

In Qualitia 8.0.0:  

  

        public static String APPIUM_NOT_RUNNING = "Failed to connect to Appium Server at " +  

  

            getAppiumServerURL()+ ". Please verify Appium server host and port and make sure that " +  

  

            "it is started before executing the test case.";    

  

In earlier versions:  

  

        public String APPIUM_NOT_RUNNING = "Failed to connect to Appium Server at " +  

  

            GLOBALS.appiumServerURL + ". Please verify Appium server host and port and make sure that " +  

  

            "it is started before executing the test case.";     

isOptimizationModeEnabled() 

This method is used to get the value of "OptimizationMode" property as specified in the execution profile. 

If it returns true then OptimizationMode is enabled else it is not.  

The method is an alternative to GLOBALS.CONFIG_OPTIMIZATION_MODE. 

isIgnoreAngularSynchronization() 

This method is used to get the value of "IgnoreAngularSynchronization" property as specified in the execution profile. 

If it returns true then AngularSynchronization is ignored else it is not.  

This is an alternative to GLOBALS.CONFIG_IGNORE_ANGULAR_SYNCHRONIZATION. 

isExecutionHighlight() 

This method is used to get the value of "ExecutionHighlight" property as specified in the execution profile. 

If it returns true then ExecutionHighlight is enabled else it is not.  

The method is an alternative to GLOBALS.CONFIG_IS_EXECUTION_HIGHLIGHT. 

getAutoITPath() 

This method is used to get the value of "AutoITPath" property as specified in the execution profile. 

Default value is "C:\\Program Files (x86)\\AutoIt3". 

The method is an alternative to GLOBALS.CONFIG_AUTOITPATH.   

getExecutionResultPath() 

This method is used to get the value of "ExecutionResultPath" property as specified in the execution profile. 

It returns the folder path where Execution Result i.e. Report regarding particular suite execution is stored. 

getExecutionEnvironment() 

This method is used to get the value of "ExecutionEnvironment" property as specified in the execution profile.  

The value can either be "LOCAL" or "REMOTE". LOCAL means local machine and REMOTE includes SauceLabs,Perfecto, TestObject etc. 

    The method is an alternative for GLOBALS.WEB_EXECUTION_ENVIRONMENT 

     For example, if a user wants to a perform a sauce related task, you can do it as: 

    In Qualitia 8.0.0: 

        if (getExecutionEnvironment().equalsIgnoreCase(ExecutionEnvironment.Sauce.getEnvironment()) 

        {//task}      

    In earlier versions: 

        if (GLOBALS.WEB_EXECUTION_ENVIROMENT.equalsIgnoreCase(ExecutionEnvironment.Sauce.getEnvironment()) 

        {//task}      

getRemoteURL() 

This method is used to get the value of "RemoteURL" property as specified in the execution profile.  

This is an alternative to GLOBALS.CONFIG_REMOTE_URL.  

It is used to get URL of remote environment like Sauce, PErfecto etc, if ExecutionEnvironment is set to remote. 

getNewBrowserMode() 

This method is used to get the value of "NewBrowserMode" property as specified in the execution profile. 

Values can either be "PerTC" or "PerSuite". If the value is PerTC then all the testcases in the suite are independent from each other. If the value is PerSuite then all the testcases are dependent on each other. 

The method is an alternative to QualitiaSelenium.getExecutionMode().

In Qualitia 8.0.0:  

        NewBrowserMode = PerTC/PerSuite 

In earlier versions: 

        QualitiaExecMode= PT/PS   

getMobileExecutionEnvironment() 

This method is used to get the value of "MobileExecutionEnvironment" property as specified in the execution profile.  

The value can be "testObject","perfectomobile","perfectoweb","saucemobile","sauceweb". 

The method is an alternative for GLOBALS.mobileExecutionEnvironment     
For example, if a user wants to a perform a sauce related task, you can do it as: 

In Qualitia 8.0.0: 

        if (getMobileExecutionEnvironment().equalsIgnoreCase(ExecutionEnvironment.Sauce.getEnvironment()) 

        {//task} 

In earlier versions: 

        if (GLOBALS.mobileExecutionEnvironment.equalsIgnoreCase(ExecutionEnvironment.Sauce.getEnvironment()) 

        {//task}      

getMobilePlatform 

This method is used to get the value of "MobilePlatform" property as specified in the execution profile.   

Values can either be IOS or Android. 

The method is an alternative to GLOBALS.mobilePlatform  

For example, if a user wants to decide which platform is being used for the testcase, you can do it as: 

In Qualitia 8.0.0: 

if (getMobilePlatform() == MobilePlatformName.ANDROID) { 

            System.out.print("ANDROID"); 

  

        } else if (getMobilePlatform== MobilePlatformName.IOS) { 

            System.out.print("IOS"); 

        } 

In earlier versions: 

if (GLOBALS.mobilePlatform == MobilePlatformName.ANDROID) { 

            System.out.print("ANDROID"); 

  

        } else if (GLOBALS.mobilePlatform == MobilePlatformName.IOS) { 

            System.out.print("IOS"); 

        }       

getQualitiaServerURL 

This method is used to get the value of "QaulitiaServerURL" property as specified in the execution profile. 

This is the URL where Qualitia Server is hosted. 

The method is an alternative to GLOBALS.CONFIG_QUALITIASERVERURL 

getProductVersion() 

This method is used to get the value of "ProductVersion" property as specified in the execution profile. 

This is the version of Qualitia being used. 

 isCurrentQFunction(String func) 

This method is used to decide if the provided func is currentlyt executing or not. 

qIt returns true if current Action running is same as func given in paramter else it returns false. 

The method is an alternative to CommonUtil.isCurrentQFunction().   

getDefaultWebExecutionPlatform 

This method is used to get the value of "DefaultWebExecutionPlatform" property as specified in the execution profile. 

The value can be MOBILE or DESKTOP. The value of this property decides on which platform will the web testcase be executed. It can be used in hybrid testcase to know which platform is being used currently. 

The method is an alternative to GLOBALS.defaultWebExecutionPlatform.  

getMobileNativeObjectsSyncTime 

This method is used to get the value of "MobileNativeObjectsSyncTime" property as specified in the execution profile. 

getBrowserBinaryPath 

This method is used to get the value of "BrowserBinaryPath" property as specified in the execution profile.   

getWindowsAuthentication 

This method is used to get the value of "WindowsAuthentication" property as specified in the execution profile. 

getReportPath 

This method is used to get the value of "ReportPath" property as specified in the execution profile. 

The method is an alternative to GLOBALS.CONFIG_REPORTPATH. 

getBrowserProfilePath 

This method is used to get the value of "BrowserProfilePath" property as specified in the execution profile. 

The method is an alternative to GLOBALS.CONFIG_CUSTOM_PROFILEPATH.  

getToolName 

This method is used to get the value of "ToolName" property as specified in the execution profile. 

The method is an alternative to GLOBALS.CONFIG_TOOLNAME.  

getExecutionType 

This method is used to get the value of "ExecutionType" property as specified in the execution profile. 

The method is an alternative to GLOBALS.CONFIG_EXECUTION_TYPE 

getGridPlatform 

This method is used to get the value of "GridPlatform" property as specified in the execution profile. 

The method is an alternative to GLOBALS.GRID_PLATFORM.   

getCurrentWebExecutionPlatform 

This method is used to get the current platform on which the Testcase is executing. It can either be MOBILE or DESKTOP. 

The method is an alternative to QualitiaTestCase.getLastDriverTypeUsed().  

setCurrentWebExecutionPlatform 

This method is used to set the current platform on which the Testcase must execute. It can either be MOBILE or DESKTOP. 

The method is an alternative to QualitiaTestCase.setLastDriverTypeUsed().  

updateWebExecutionPlatformSystemVariables 

This method is  used to update web execution platform in system variables. 

getLastDriverTypeUsed 

This method is used to get the value of driver type used. It can be Web or Mobile. 

The method is an alternative to QualitiaTestCase.getLastDriverTypeUsed().  

setLastDriverTypeUsed 

This method is used to set the value of driver type used. It can be Web or Mobile. 

The method is an alternative to QualitiaTestCase.setLastDriverTypeUsed() 

resolveSpecialCharactersAndVariablesAndEscape 

This method is used to remove all the special characters and escape characters from expression provided in conditions like IF. 

The method is an alternative to FwUtil.resolveSpecialCharactersAndVariablesAndEscape().   

resolveSpecialCharactersAndVariables 

This method is used to remove all the special characters and escape characters from expression provided in conditions like IF. 

The method is an alternative to FwUtil.resolveSpecialCharactersAndVariables(). 

resolveObjectProperties 

This method is used to resolve object properties.  

getExecutionMode 

This method is used to get the Execution Mode value. Value can either be PS(PerSuite) or PT (PerTestCase). 

The method is an alternative to QualitiaSelenium.getExecutionMode() 

Debugging a Custom Action

You need to download the TestHarness.Java file, and download and extract the Config Folder file.

To debug a custom action

  1. Do in the following order listed to create necessary test artifacts:

    1. Create a test case and include the custom action that you want to debug at the appropriate step. For more information, refer to Work with Test Cases

    2. From the test case editor, click Run to dry run the test case to verify whether the custom action is hit.

    3. Create a test suite that contains the test case. For more information, refer to Creating a Suite.

    4. Create an offline suite using the test suite. For detailed instructions, refer to Creating an Offline Package.

  2. To add the required files for debugging the custom action:

    1. Open the custom action you want to debug in the Eclipse project.

    2. Add the TestHarness.Java file for the custom action in the Eclipse project.

    3. Add the Config Folder in the Eclipse project.

    4. In the config folder, open the startupSettings.json file, and specify the location of the offline suite for “SuitesDir”.
      For example: "SuitesDir":"D:/Qualitia Offline/Suite1"

  3. Insert a breakpoint at an appropriate line number in the custom action.

  4. Start debugging the TestHarness.Java file.

  5. The test suite execution starts.
    When the custom action is executed, the execution stops at the breakpoint you have inserted.
    You can go ahead and debug the custom action.

To specify Java system properties before executing the test suite.

  1. From the config folder in the custom action of Eclipse, open the QualitiaSystemProperties.json.

  2. In the QualitiaSystemProperties.json file, enter the key-value pairs in the following format:

    1. {"key1": "value1",

      "key2": "value2",

      .

      .

      "keyN": "valueN"}

  3. Save the file.   

Troubleshooting (Custom Action Module)

You might get following errors while importing custom actions in Qualitia automation studio. You must fix these errors to complete the import procedure. 

Import Custom Action Cannot be continue due to following errors;...

You will get this error in case the directory you have selected to import custom actions is missing one or more required sub-folders. 

Resolution:

To resolve this error, ensure you have selected the right directory to import custom actions and the selected directory has all the sub-folders created in it.

Updating Qualitia Project Path

After you change the project path in Qualitia, you must re-import the java project from the new directory into the existing java workspace.

Re-importing this java project is mandatory. Else, the user will not be able to access updated custom actions.  This is a one-time activity.

To re-import the project:

  1. Ensure you clone all the project data to the new directory.
    This includes Test cases, Tasks, Custom actions, and Java project folders (which hold all the latest custom action code).

  2. Remove the existing project from the workspace.

  3. To import the cloned java project from the new directory, right-click Package Explorer, and select Import from the context menu.

  4. On the Import window, under the General section, select Existing Projects into Workspace and then click Next.

  5. In the Select root directory section, click the Browse button, select <PROJECTNAME>_QASJavaproject and click Finish.
    This is in the new directory where you have cloned the Qualitia project data.

  6. Select General > Workspace > Select Refresh using native hooks or polling.

  7. Click Apply and Close.

Custom Action Custom Files are Not Pushed to Project Path GIT Repository

Problem: While editing or adding a custom action, if you encounter the following message:

The method or operation is not implemented.

Summary: This error occurs because the custom action class files are not pushed to the Project path GIT Repository.

Solution:

Perform the following steps:

  1. Open the Eclipse Project.

  2. Click Windows > Preferences > Teams > Git > Projects.

  3. In the right side of the Preference dialog box, under Projects, deselect the Automatically ignore derived resources by adding them.gitignore checkbox.

Other Validations

While importing custom actions code into automation studio, Qualitia validates certain things. In case some files or code is missing, Qualitia gives the list of issues to fix to continue importing custom actions.

Here is the complete list of validations and resolutions to be done.

Validation Error

Resolution

Validation Error

Resolution

.classpath file is not present in your Eclipse project location 

Ensure that the Eclipse project was built successfully after adding all required artifacts (lib, bin, src folders) to it. This will create a .classpath file. 

.class files are not present in your Eclipse project location 

Collect the required compiled .class files and add them to the Eclipse project (under bin folder). Names of the required files is mentioned in the report.

Jar files mentioned in .classpath in your Eclipse project location

Collect all the required jar files and add them to your Eclipse project directory (under lib folder).

Java source files are not present in your Eclipse project location 

You need to generate the source code from the compiled class files and add them into the src folder under Eclipse project directory. For more information on the creating the source files, refer to the Importing Existing Custom Actions Created in Previous Qualitia Versions section. 

Once you have fixed all the errors mentioned above, you can continue importing custom actions in Qualitia. 

Working with Custom Actions for Desktop Projects

After you import all your existing custom actions in Qualitia, you can now create, modify, search, or view the custom action codes in Qualitia automation studio itself. In the cases of multi user scenario, you can share these actions easily with other team members just as you share your tasks and test cases.

Also, any of the project members can update the code using an Eclipse IDE based on the requirements. You can launch an Eclipse IDE from Qualitia automation studio itself.

Creating a Custom Action for Desktop Projects

You can create a custom action to enable execution on desktop objects for which you need to program in Visual Basic. Also, you can create general web actions that do not require desktop objects.  

Before creating a custom action, if you have a VB editor other than Notepad, then edit the VB Editor path in Project Settings. 

For example, if you want to create custom action as "CustomSetValueInEditBox" for WebEdit, create a new vbs file with name CustomWebEdit. This action will set the specified value into the webedit so method will look similar to below.

The first arg is the webedit object as this action will directly perform the action on the edit boxobject. The second arg is of type string which is the value that needs to be set in the edit box. The custom action returns with an integer value.

If the action does not interact with any object then ObjectInfo parameter is not required.

Note: You cannot modify a custom action code in the Visual Basic file, if the file is locked by another user.

To create a custom action for desktop projects:

  1. Open the desktop project where you want to create a custom action.

  2. From the Expand Menu, click Custom Actions.

  3. Click the Custom Actions tab.

  4. Do the following in the order listed.

    1. Enter the name of action, in Action Name.

    2. Enter the role of the custom action, in Description.

    3. From the Technology drop-down list, select the technology under which you want to create a  custom action.

    4. From the Base Class drop-down list, select a base class.

    5. If you select a base class as General to create general actions, you get a pop-up to select  Java or VB.
      Do one of the following:

    6. From the VBS File drop-down list, do one of the following:

      1. Select an existing visual basic file.

      2. Select Create New File to create a new visual basic file. Enter the name of the new VB file you want to create without including its extension.

    7. From the Functions drop-down list, do one of the following:

      1. Select an existing function.

        You must ensure that you do not map a function created for a General Action to a Non General Action and vice versa.  However, if you do so, you might see unexpected behaviour of your Custom Action.

      2. Select Create New Function to create a new function. Enter the name of new function.

  5. Under Properties, do one of the following:

    1. If you have selected an existing function, the existing arguments are displayed. You need to select data type for existing parameters.

    2. If you have selected a new function, add new parameters along with their data types.

  6.  Do one of the following;

    • Click Save to save the custom action in the selected VB script file.

    • Click Save and Launch Editor to save the custom action in the selected VB script file and then launch this file in the VB editor.

      The custom action is added.

  7. Click Edit Code to write codes to develop the custom action.
    You need to consider the custom action rules.

Rules for Mapping Custom Actions

  • The parameter types supported by Qualitia QTP / UFT are String, integer, and Array.

  • Error Resume Next Statement

Add the On Error Resume Next statement at the beginning of the function and the On Error Goto 0 statement before the function end.

For Example,

Function Test()

            On Error Resume Next          

            On Error Goto 0

     End Function

  • Execution Report Value

All custom actions shall return following integer values only as shown in the following table.

Return

Description

Return

Description

Pass

For passed test cases

Fail

For failed test cases

Defect

For defective test cases

No two custom actions can have the same function name in the same class.

Once the custom action is mapped into Qualitia and used in a test case, do not change the existing signature or other details of the action. The logic of the action can be modified. Also do not delete the action that has been used in the Test Case.

  • Add the following block to report the function execution status back to Qualitia Report

For example,

If err.number = Pass Then

            WaitFor = Pass

            WriteStatusToLogs "Action: "&strMethod&vbtab&_

            "Status: Passed " &Vbtab&_

            "Message: Waited successfully for "&intWaitTime&" secs"

     Else               

            WaitFor = Fail

            WriteStatusToLogs "Action: "&strMethod&vbtab&_

"Status: Failed" &Vbtab&_

            "Message: An error occurred during the wait"

     End If

Assign the execution report value as Pass or Fail to the function. You can also assign the value using variables ‘STATUS_PASSED’, ‘STATUS_FAILED’ and ‘STATUS_DEFECT’. The WriteStatusToLogs is used to display the message in Qualitia execution report.

  • Return a Value or Store a Value in a Variable

To return a value/store a value in variable from custom action, we need to use the following code:

For example,  AddItemToStorageDictionary strKey, strValue

The required value, strValue will be stored in the variables strKey and it can be used across the test case to retrieve the variable value. 

  • Using or Passing integer values in Qualitia

To use any value as an integer inside the custom action, make sure to use Cint() and specify the data type as String while mapping the custom action in QFD.

  • Debugging a Custom Action

If you wish to debug the action, then create a test case in Qualitia using the newly created custom action.

Perform a dry run of the test case and once UFT is invoked, insert a debug point.

Modifying Custom Actions

Over the course of the project, you might want to update the custom action code to handle more scenarios with the same action. You can modify the custom action code in such cases.

Modify Custom Action Metadata

To edit custom action metadata:

  1. From the Expand Menu, click Develop.

  2. Click the Custom Actions tab.

  3. In the left pane, click the desired custom action which you want to update.
    Custom action details will appear in the right pane.

  4. Click Edit.

  5. Update Action Name, Description, Function Name, and parameters details based on the requirements.

  6. Click Save and Launch Editor.

Modify Custom Action Code

You can modify existing custom action code using the Eclipse IDE.

  1. From the Expand Menu, click Develop.

  2. Click the Custom Actions tab.

  3. In the left pane, select the desired custom action which you want to update.
    Custom action details will appear in the right pane.

  4. Click View Code.
    The code appears in the different section.

  5. To update the code in the Eclipse IDE, click Edit Code.
    The code template with an existing code opens in the Eclipse IDE.

  6. Update the code based on the requirements.

  7. Build the project and close Eclipse IDE.

    Once you close the Eclipse IDE, Qualitia automatically commits the code to the version control system like Bitbucket or SVN (if configured) and makes the code available to other Qualitia project members.

Deleting Custom Actions

You can delete the custom actions only if they are not used in any of the test case or task.

To delete the custom action:

  1. From the Expand Menu, click Develop.

  2. Click the Custom Actions tab.

  3. Search the desired custom action.

  4. Select the action in the left pane.
    Custom action details will appear in the right pane.

  5. Click Delete.

Footer