This shows you the differences between two versions of the page.
en:user_object_adaptor [2020/10/26 12:08] montse |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== User Object Adaptor ====== | ||
- | |||
- | |||
- | ===== Introduction ===== | ||
- | |||
- | This adapter is used to execute the flow information of the TAST execution process, by manipulating variables that are used to obtain and establish values in the adapters, as well as in decision making and loops. | ||
- | |||
- | ===== Configuration ===== | ||
- | |||
- | No information is established during initialization of the adapter. It is by using the information of the predefined functions where it is performed. | ||
- | |||
- | |||
- | ===== Initialization Parameters ===== | ||
- | |||
- | There are no Initialization Parameters. | ||
- | |||
- | ===== Functions ===== | ||
- | |||
- | * **assertion(stepResult,...):** Executes the JavaScript function using the variables that are introduces as input parameters and returns a boolean. | ||
- | |||
- | * **compareParameters(Element1, Element2):** Compares two values with an operator chosen by the user. Returns true or false. | ||
- | |||
- | * **compareVariables(Name 1, Name 2):** Compares two variables. Returns true if the operator condition is met. | ||
- | |||
- | * **copyFile():** This predefined function makes a copy of a file and move it to a new place. The input parameters are:\\ | ||
- | * sourceFile, to enter the file you want to copy. | ||
- | * targetFile, to select where you want this file (it can be the same path). And | ||
- | * preserveFile, a Boolean, if “true” its marked it put the date of the file same as the original one.\\ \\ If the names and the path of the original and the copy are the same, the name of the copy is changed for **copy-“thenameoftheoriginal”.”ext”**. | ||
- | |||
- | * **executeCommand():** Executes a command in Windows O.S. The aim of this PF is to execute commands in the local console. This is the reason because is located into the User Adaptor.\\ | ||
- | * The Input parameter is the command itself. The command has to be preceded with the string **"cmd /c"**, for example:\\ **"cmd /c dir /p"** to list the files in a directory, or **"cmd /c copy pathfileOrg pathfileDst"** to copy one file to another. | ||
- | |||
- | * **executeJavaScript(NameFunction):** Executes the javaScript function whose name is entered as a parameter. The function can have input parameters and return a value. The input parameters will be the variables defined with setVariable, or the results of other predefined functions. The value that returns will be saved in the output variable. | ||
- | | ||
- | * **failTest(ErrorMsg):** Returns error with or without the error message that the user enters in the ErrorMsg parameter. | ||
- | | ||
- | * **getCurrentDate(DateFormat):** Returns the current date with the established format or format by default in a parameter of type TASTDATATABE. To get: current date -> TASDATATABLE [1]. Current day-> TASDATATABLE [2]. Current month-> TASDATATABLE [3]. Current year (yyyy) -> TASDATATABLE [4]. Current year (yy) -> TASDATATABLE [5]. | ||
- | |||
- | * **getCurrentDateAsDate():** Returns the current date as a Date type. Input parameters are not required. | ||
- | |||
- | * **getCurrentDateAsString():** Returns the current date as a String type with the format introduced by the user in the input parameter dateFormat as a value.\\ \\ {{ :en:datetype.png?700| }}\\ \\ | ||
- | |||
- | * **isExistVariable():** This function checks if the variable exists. Returns “yes” if exist or “no” otherwise. “Name” is the input parameter used to check it and it is case sensitive. | ||
- | |||
- | * **manualTast():** Launches the process of [[en:manual_intervention|Manual Intervention]] to allow the user to create and document Manual Test Cases, uploading it to ALM. Input parameters are not needed. | ||
- | |||
- | * **removeVariable():** Removes the variable whose name is entered as a parameter. “Name” is the input parameter used to remove it and it is case sensitive. | ||
- | | ||
- | * **replaceAll():** Replaces all substring of this string that matches the given regular expression with the given replacement. The input parameters are varName (to indicate the name of the variable we want to change), regex (regular expression), and replacement. | ||
- | |||
- | * **sendKeys(String, Delay in miliseconds):** This function sends the keys one by one where the cursor is at this moment. It receives two parameters: keys to send, for example: ~!@#$%^&*()_+{}|:\”<>? abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ çÇáÉñÑä (Optional) Delay in milliseconds between keys, for example 200. | ||
- | |||
- | * **sendKeysCombination (Key+Key, Delay in miliseconds):** This function sends the combinations of the keys (or Java Robot KeyEvent API) one by one separated by a + where the cursor is at this moment. For Java Robot KeyEvent API see link: 'https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html'.\\ Receive two parameters: Combination of keys to send, for example: “Control+a”, “Control+z”, “Control+alt+3”, “delete”, “VK_CONTROL+VK_A”, “VK_CONTROL+VK_ALT+VK_A”, “VK_DELETE” etc… (Optional) Delay in milliseconds between keys, for example 200.\\ \\ The list of allowed Keys are: ADD, ALT, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, BACKSPACE, BACK_SPACE, CANCEL, CLEAR, COMMAND, CONTROL, DECIMAL, DELETE, DIVIDE, DOWN, END, ENTER, EQUALS, ESCAPE, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, HELP, HOME, INSERT, LEFT, LEFT_ALT, LEFT_CONTROL, LEFT_SHIFT, META, MULTIPLY, NULL, NUMPAD0, NUMPAD1, NUMPAD2, NUMPAD3, NUMPAD4, NUMPAD5, NUMPAD6, NUMPAD7, NUMPAD8, NUMPAD9, PAGE_DOWN, PAGE_UP, PAUSE, RETURN, RIGHT, SEMICOLON, SEPARATOR, SHIFT, SPACE, SUBTRACT, TAB, UP | ||
- | |||
- | * **sendKeysPaste (Text):** This function executes pasting the text where the cursor is at this moment. Like buffered text paste using “Control+V” combination. Receive one parameter: Text to paste, for example: ~!@#$%^&*()_+{}|:\”<>? abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ çÇáÉñÑä | ||
- | | ||
- | * **setVariable():** Creates a variable whose name is entered as a parameter. The variable types are: TastTableData, String, Integer, Double, Date or Boolean.\\ To create an array from this function, the user has to create a variable type TASTTABLEDATA and add in the value box the value like the following example:\\ [ [\\ {"type":"STRING","value":"myfirstdata"}\\ ,\\ {"type":"STRING","value":"myseconddata"}\\ ,\\ {"type":"INTEGER","value":"3"}\\ ],[\\ {"type":"STRING","value":"segovia"}\\ ,\\ {"type":"STRING","value":"avila"}\\ ,\\ {type":"INTEGER","value":"24"}\\ ] ]\\ ¨The same happens with: TASTROWTABLEDATA\\ [ [ \\ {"type":"DOUBLE","value":"5.25"}\\ ,\\ {"type":"DATE","value":"05/08/2019"}\\ ,\\ {"type":"BOOLEAN","value":"false"}\\ ] ]\\ \\ The allowed types of variables are:\\ STRING; INTEGER; DOUBLE; DATE; BOOLEAN.\\ \\ Also the first value in a tastTableData and tastRowTableData is 1.\\ \\ As posible confusion cases, to use the elements of a table, for example to use "value":"05/08/2019" the user can do it like: #nameOfTheTastRowTableData.getCellValue(2), this way the user will obtain the value of the example in the tastRowTableData.\\ \\ Another case could be the user capability to edit the space in certain position of the “array” for example to edit: "value":"05/08/2019" in tastRowTableData, could be done with: #nameOfTheTastRowTableData.setCellValue(2, "05/08/2019"). | ||
- | | ||
- | * **systemCloseProgram():** Close system program. Closes the Outlook of your system. With the input parameter you choose between two options, “hxoutlook” or “outlook”. | ||
- | |||
- | * **takeScreenshot():** This function does an screenshot with Java Robot to an element that is visible at that moment in the user screen. It does not require input parameters and the data will be stored in evidences folder. | ||
- | |||
- | * **waitFor():** Waits a certain amount of time introduced in the input parameter timeInSeconds. | ||
- | |||
- | |||
- | |||
- | |||
- | |||