...
- 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.
...
Expand | |||||
---|---|---|---|---|---|
| |||||
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.
|
Expand | ||
---|---|---|
| ||
To create and compile custom action project:
|
...
Expand | ||
---|---|---|
| ||
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.
|
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
- Eclipse IDE for Java Developers (Version 2019-03 recommended)
- JDK version 1.8 and JRE version 1.8
Both JDK and JRE are bundled with the above Eclipse IDE version. - Custom Action Developer privileges in Qualitia
- Set Eclipse Path under Project Settings
- Add multiple jar files under Project Settings
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.
...
- From the Expand Menu, click Develop.
- Click the Custom Actions tab.
- Click the Add Button ( ) or Create Custom Action button.
The Custom Actions screen appears. - 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. - Do one of the following:
- To add a new Qualitia Class:
- 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.
- 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.Info title 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 a new Qualitia Class:
- Enter Action Name, Description and Function Name for the action to be created.
- In the Properties section, click Add.
A new line will be added in the grid. - Add Parameter Name, Description, ArgDataType for the parameter, and select whether this parameter is mandatory.
- To save the action, click Save.
- To save the action and launch the code template in Eclipse IDE, click Save and Launch Eclipse.
- Close the Welcome on the IDE window to see your auto-generated custom action code template.
- Import the pre-created Custom Action Java project workspace into Eclipse workspace.
This is a one-time activity for a project.- To import the pre-created workspace, right-click Package Explorer, and select Import from the context-menu.
- On the Import window, under the General section, select Existing Projects into Workspace and then click Next.
- 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.
- In Eclipse IDE, from the Window menu, select Preferences.
- Select General > Workspace > Select Refresh using native hooks or polling.
- Click Apply and Close.
- 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.
- In the editor, add the custom action code in the provided template for your custom action.
- To add the dependent jars, do the following in the order listed:
- Add the dependent jar files in the lib folder under the project.
- Right-click the Project, point to Build Path, and then select Configure Build Path.
- Click Libraries > Add JARs.
- Under Jar Selection window, expand the Project folder.
- Under the lib folder, select the dependent Jar, and click Ok.
- Click Apply and Close.
- Add the dependent jar files in the lib folder under the project.
- 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.
...
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 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.
...
Code Block | ||
---|---|---|
| ||
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.
...
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.
...
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 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.
...
Code Block |
---|
In Older Versions before 8.0.0 : 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; } } In Qualitia 8.0.0 Version : 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”,FailureCategories.Category.INVALID_DATA); actionResponse.setExecutionResult(ExecutionResult.FAILED); return actionResponse; } } |
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.
...
Code Block | ||
---|---|---|
| ||
actionResponse.setMessage("message",FailureCategory.newCategory(MY_CUSTOM_CATEGORY3)); |
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()
...
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().
...
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.
...
The method is an alternative to Controller.STOREHASHMAP.containsKey()
setCurrentWebExecutionPlatform(value)
This method is used to set the value of "CurrentWebExecutionPlatform".
...
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".
...
//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.
...
//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.
...
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.
...
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.
...
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.
...
return 1;
}
}
getStepId()
This method is used to get the step ID.
...
String stepid = Controller.strStepID;
getTaskName()
This method is used to get the name of the current task which is being executed.
...
String Taskname= Controller.taskName;
getTestCaseName()
This method is used to get the name of current TC being executed.
...
String TCname = Controller.testCaseName;
getTestCaseNameWithoutSpecialChars()
This method is used to get the name of current TC being executed, without special characters like escape character(~).
...
String TCname= Controller.testCaseNameWithoutSpecialChars;
getScenarioName()
This method is used to get the name of scenario being executed
...
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 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:
...
String objectID = Controller.strObjectID;
getIterationFolderPath()
This method is used to get the Iteration folder path (report related data).
...
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.
...
"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.
...
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.
...
//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.
...
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.
...
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.
...
String mobilePaltform = getQualitiaPropValue("MobilePlatform"
getSelectedWaitMode()
This method is used to get the value of "WaitMode" property as specified in the execution profile.
...
// 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.
...
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.
...
if (QualitiaSelenium.getBrowser().equalsIgnoreCase(CONSTANTS.FIREFOX)
{
//task
}
getParamTypes()
This method is used to get the parameter types of an action.
...
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.
...
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.
...
_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()
...
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:
...
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.
...
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.
...
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.
...
The method is an alternative to GLOBALS.mobileBrowserName.
getAppiumServerURL()
This method is used to get appium server URL where appium server is hosted.
...
"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.
...
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.
...
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.
...
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.
...
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.
...
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.
...
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.
...
QualitiaExecMode= PT/PS
getMobileExecutionEnvironment()
This method is used to get the value of "MobileExecutionEnvironment" property as specified in the execution profile.
...
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.
...
System.out.print("IOS");
}
getQualitiaServerURL
This method is used to get the value of "QaulitiaServerURL" property as specified in the execution profile.
...
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.
...
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 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).
...
Debugging a Custom Action
You need to download the TestHarness.Java file, and download and extract the Config Folder file.
...
Do in the following order listed to create necessary test artifacts:
Create a test case and include the custom action that you want to debug at the appropriate step. For more information, refer to /wiki/spaces/T2/pages/2681539278
From the test case editor, click Run to dry run the test case to verify whether the custom action is hit.
Create a test suite that contains the test case. For more information, refer to Creating a Suite.
Create an offline suite using the test suite. For detailed instructions, refer to Creating an Offline Package.
To add the required files for debugging the custom action:
Open the custom action you want to debug in the Eclipse project.
Add the TestHarness.Java file for the custom action in the Eclipse project.
Add the Config Folder in the Eclipse project.
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"
Insert a breakpoint at an appropriate line number in the custom action.
Start debugging the TestHarness.Java file.
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.
Info |
---|
To specify Java system properties before executing the test suite.
|
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.
Table of Contents | ||
---|---|---|
|
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.
...
- 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). - Remove the existing project from the workspace.
- To import the cloned java project from the new directory, right-click Package Explorer, and select Import from the context menu.
- On the Import window, under the General section, select Existing Projects into Workspace and then click Next.
- 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. - Select General > Workspace > Select Refresh using native hooks or polling.
- 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:
...
Open the Eclipse Project.
Click Windows > Preferences > Teams > Git > Projects.
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.
...
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 (8.3.0 2) 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.
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.
...
Expand | |||||
---|---|---|---|---|---|
| |||||
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.
|
Expand | ||
---|---|---|
| ||
To create and compile custom action project:
|
...
Expand | ||
---|---|---|
| ||
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.
|
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
- Eclipse IDE for Java Developers (Version 2019-03 recommended)
- JDK version 1.8 and JRE version 1.8
Both JDK and JRE are bundled with the above Eclipse IDE version. - Custom Action Developer privileges in Qualitia
- Set Eclipse Path under Project Settings
- Add multiple jar files under Project Settings
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.
...
- From the Expand Menu, click Develop.
- Click the Custom Actions tab.
- Click the Add Button ( ) or Create Custom Action button.
The Custom Actions screen appears. - 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. - Do one of the following:
- To add a new Qualitia Class:
- 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.
- 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.Info title 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 a new Qualitia Class:
- Enter Action Name, Description and Function Name for the action to be created.
- In the Properties section, click Add.
A new line will be added in the grid. - Add Parameter Name, Description, ArgDataType for the parameter, and select whether this parameter is mandatory.
- To save the action, click Save.
- To save the action and launch the code template in Eclipse IDE, click Save and Launch Eclipse.
- Close the Welcome on the IDE window to see your auto-generated custom action code template.
- Import the pre-created Custom Action Java project workspace into Eclipse workspace.
This is a one-time activity for a project.- To import the pre-created workspace, right-click Package Explorer, and select Import from the context-menu.
- On the Import window, under the General section, select Existing Projects into Workspace and then click Next.
- 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.
- In Eclipse IDE, from the Window menu, select Preferences.
- Select General > Workspace > Select Refresh using native hooks or polling.
- Click Apply and Close.
- 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.
- In the editor, add the custom action code in the provided template for your custom action.
- To add the dependent jars, do the following in the order listed:
- Add the dependent jar files in the lib folder under the project.
- Right-click the Project, point to Build Path, and then select Configure Build Path.
- Click Libraries > Add JARs.
- Under Jar Selection window, expand the Project folder.
- Under the lib folder, select the dependent Jar, and click Ok.
- Click Apply and Close.
- Add the dependent jar files in the lib folder under the project.
- 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.
...
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 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.
...
Code Block | ||
---|---|---|
| ||
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.
...
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.
...
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 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.
...
Code Block |
---|
In Older Versions before 8.0.0 : 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; } } In Qualitia 8.0.0 Version : 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”,FailureCategories.Category.INVALID_DATA); actionResponse.setExecutionResult(ExecutionResult.FAILED); return actionResponse; } } |
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.
...
Code Block | ||
---|---|---|
| ||
actionResponse.setMessage("message",FailureCategory.newCategory(MY_CUSTOM_CATEGORY3)); |
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()
...
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().
...
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.
...
The method is an alternative to Controller.STOREHASHMAP.containsKey()
setCurrentWebExecutionPlatform(value)
This method is used to set the value of "CurrentWebExecutionPlatform".
...
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".
...
//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.
...
//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.
...
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.
...
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.
...
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.
...
return 1;
}
}
getStepId()
This method is used to get the step ID.
...
String stepid = Controller.strStepID;
getTaskName()
This method is used to get the name of the current task which is being executed.
...
String Taskname= Controller.taskName;
getTestCaseName()
This method is used to get the name of current TC being executed.
...
String TCname = Controller.testCaseName;
getTestCaseNameWithoutSpecialChars()
This method is used to get the name of current TC being executed, without special characters like escape character(~).
...
String TCname= Controller.testCaseNameWithoutSpecialChars;
getScenarioName()
This method is used to get the name of scenario being executed
...
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 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:
...
String objectID = Controller.strObjectID;
getIterationFolderPath()
This method is used to get the Iteration folder path (report related data).
...
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.
...
"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.
...
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.
...
//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.
...
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.
...
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.
...
String mobilePaltform = getQualitiaPropValue("MobilePlatform"
getSelectedWaitMode()
This method is used to get the value of "WaitMode" property as specified in the execution profile.
...
// 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.
...
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.
...
if (QualitiaSelenium.getBrowser().equalsIgnoreCase(CONSTANTS.FIREFOX)
{
//task
}
getParamTypes()
This method is used to get the parameter types of an action.
...
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.
...
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.
...
_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()
...
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:
...
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.
...
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.
...
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.
...
The method is an alternative to GLOBALS.mobileBrowserName.
getAppiumServerURL()
This method is used to get appium server URL where appium server is hosted.
...
"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.
...
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.
...
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.
...
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.
...
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.
...
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.
...
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.
...
QualitiaExecMode= PT/PS
getMobileExecutionEnvironment()
This method is used to get the value of "MobileExecutionEnvironment" property as specified in the execution profile.
...
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.
...
System.out.print("IOS");
}
getQualitiaServerURL
This method is used to get the value of "QaulitiaServerURL" property as specified in the execution profile.
...
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.
...
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 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).
...
Debugging a Custom Action
You need to download the TestHarness.Java file, and download and extract the Config Folder file.
...
Do in the following order listed to create necessary test artifacts:
Create a test case and include the custom action that you want to debug at the appropriate step. For more information, refer to /wiki/spaces/T2/pages/2681539278
From the test case editor, click Run to dry run the test case to verify whether the custom action is hit.
Create a test suite that contains the test case. For more information, refer to Creating a Suite.
Create an offline suite using the test suite. For detailed instructions, refer to Creating an Offline Package.
To add the required files for debugging the custom action:
Open the custom action you want to debug in the Eclipse project.
Add the TestHarness.Java file for the custom action in the Eclipse project.
Add the Config Folder in the Eclipse project.
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"
Insert a breakpoint at an appropriate line number in the custom action.
Start debugging the TestHarness.Java file.
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.
Info |
---|
To specify Java system properties before executing the test suite.
|
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.
Table of Contents | ||
---|---|---|
|
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.
...
- 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). - Remove the existing project from the workspace.
- To import the cloned java project from the new directory, right-click Package Explorer, and select Import from the context menu.
- On the Import window, under the General section, select Existing Projects into Workspace and then click Next.
- 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. - Select General > Workspace > Select Refresh using native hooks or polling.
- 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:
...
Open the Eclipse Project.
Click Windows > Preferences > Teams > Git > Projects.
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.
...
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 (8.3.0 2) 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.
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
Info |
---|
For custom actions that are added to a task or a test case, you can update only the Mandatory status of its parameters and no other metadata |
...
- From the Expand Menu, click Develop.
- Click the Custom Actions tab.
- In the left pane, click the desired custom action which you want to update.
Custom action details will appear in the right pane. - Click Edit.
- Update Action Name, Description, Function Name, and parameters details based on the requirements.
- 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.
Modify Custom Action Code
You can modify existing custom action code using the Eclipse IDE.
...
- From the Expand Menu, click Develop.
- Click the Custom Actions tab.
- In the left pane, select the desired custom action which you want to update.
Custom action details will appear in the right pane. - Click View Code.
The code appears in the different section. - To update the code in the Eclipse IDE, click Edit Code.
The code template with an existing code opens in the Eclipse IDE. - Update the code based on the requirements.
- 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.
...