Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.  

...

Expand
title1. Gather or generate all java source files at one place.

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>"

    Code Block
    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.

Expand
title2. Create an Eclipse project and compile the project with all the custom actions.

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.

...

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.

...

To create new custom action in Qualitia:

  1. From the Expand Menuthe Expand menu, click Develop.

  2. Click the Custom the Custom Actions tab.

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

  4. Select Base Class.
    (warning) 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.
    (info) 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.

Info

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.

...

For more information, refer to (8.6.X) Real Time Reporting Portal . Viewing a Failure Summary Report .

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

Code Block
package com.webdriverfw.Wrappers; 

 Import com.qualitia.execution.failureclassifications.FailureClassificatio; 

 public enum MyCategoriesEnum implements FailureClassification { 

    MY_CUSTOM_CATEGORY1("This is my custom category 1"), 

    MY_CUSTOM_CATEGORY2("This is my custom category 2"); 
 

    private String name; 


    MyCategoriesEnum(String s) { 

        name = s; 

    } 

   public String getCategory() { 

        return name; 

    } 

}   

...

  • if (locatorType.equalsIgnoreCase(CONSTANTS.ID)) { 

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

            } 

...

  • if (locatorType.equalsIgnoreCase(CONSTANTS.ID)) { 

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

            }      

...

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

}

In earlier versions: 

...

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

            }      

...

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 profile or if driver is downloaded automatically then it is a default value. 

...

String suiteName = getSuiteName(); 

In earlier versions:
String suiteName = Controller.suiteName; 

...

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

...

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.json 

getMobileURL 

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

This is an alternative to GLOBALS.appiumServerURL.appiumServerURL 

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

  In Qualitia 8.0.0: 

...

The method is an alternative to GLOBALS.CONFIG_CITOOL CITOOL.

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

...

This is an alternative to QualitiaSelenium.isDesktopExecution.isDesktopExecution   

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

...

The method is an alternative to GLOBALS.CONFIG_BUILD_NUMBER NUMBER. 

getReleaseNum 

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

...

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

In Qualitia 8.0.0: 

 shutdownMobileDriverSession() 

...

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

...

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

...

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 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 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  For example, if a user wants to a perform a sauce related task, you can do it as: 

    In  In Qualitia 8.0.0: 

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

        {//task}      

    In  In earlier versions: 

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

...

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

...

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 GLOBALS.CONFIG_QUALITIASERVERURL QUALITIASERVERURL.

getProductVersion() 

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

...

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

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

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

...

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.

...

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

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. 

...

  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.

...

  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.

    Info

    For desktop project custom action developed in VB, you cannot add or remove parameters from the mapped function for an unused cutsom action from Qualitia client.  To work around this issue, launch the associated VBS file from Qualitia client, add or remove parameters for the mapped function, and remap the function to the custom action from Custom Action window.

...